(dchr): Negative d_cost now means that only deity can designate.

(nullify_objects, do_desi): Simpify designate restrictions of options
NO_LCMS, NO_HCMS, NO_OIL.

(show_sect_build): Suppress printing of sectors only deity can
designate.  This was broken in rev. 1.15.
This commit is contained in:
Ron Koenderink 2004-10-29 01:38:06 +00:00
parent 8179063330
commit 8d792e1b9f
4 changed files with 26 additions and 53 deletions

View file

@ -96,18 +96,8 @@ do_desi(struct natstr *natp, s_char *sects, s_char *deschar, long int cash,
while (!player->aborted && nxtsct(&nstr, &sect)) {
if (!player->owner)
continue;
if (!player->god) {
if (sect.sct_type == SCT_MOUNT ||
sect.sct_type == SCT_BTOWER ||
sect.sct_type == SCT_BSPAN ||
sect.sct_type == SCT_WASTE ||
sect.sct_type == SCT_PLAINS ||
(opt_NO_LCMS && sect.sct_type == SCT_LIGHT) ||
(opt_NO_HCMS && sect.sct_type == SCT_HEAVY) ||
(opt_NO_OIL && sect.sct_type == SCT_OIL) ||
(opt_NO_OIL && sect.sct_type == SCT_REFINE))
continue;
}
if (!player->god && dchr[sect.sct_type].d_cost < 0)
continue;
sprintf(prompt, "%s %d%% %s desig? ",
xyas(sect.sct_x, sect.sct_y, player->cnum),
sect.sct_effic, dchr[sect.sct_type].d_name);
@ -127,28 +117,23 @@ do_desi(struct natstr *natp, s_char *sects, s_char *deschar, long int cash,
return (long)-RET_FAIL;
}
if (!player->god) {
if (des == SCT_WATER || des == SCT_MOUNT ||
des == SCT_SANCT || des == SCT_PLAINS ||
(opt_NO_LCMS && des == SCT_LIGHT) ||
(opt_NO_HCMS && des == SCT_HEAVY) ||
(opt_NO_OIL && des == SCT_OIL) ||
(opt_NO_OIL && des == SCT_REFINE)) {
if (for_real)
pr("Only %s can make a %s!\n", cname(0), dchr[des].d_name);
continue;
}
if (des == SCT_WASTE) {
if (for_real)
pr("Only a nuclear device (or %s) can make a %s!\n",
cname(0), dchr[des].d_name);
continue;
}
if (dchr[des].d_cost < 0) {
if (for_real)
pr("Only %s can make a %s!\n", cname(0), dchr[des].d_name);
continue;
}
}
if (sect.sct_type == des && sect.sct_newtype == des)
continue;
if (sect.sct_type == SCT_SANCT)
breaksanct++;
if (des == SCT_HARBR) {
if ((des == SCT_HARBR) || (des == SCT_BHEAD)) {
for (n = 1; n <= 6; n++) {
getsect(nstr.x + diroff[n][0],
nstr.y + diroff[n][1], &check);
@ -170,33 +155,11 @@ do_desi(struct natstr *natp, s_char *sects, s_char *deschar, long int cash,
continue;
}
}
if (des == SCT_BHEAD) {
for (n = 1; n <= 6; n++) {
getsect(nstr.x + diroff[n][0],
nstr.y + diroff[n][1], &check);
if (check.sct_type == SCT_WATER)
break;
if (check.sct_type == SCT_BSPAN)
break;
if (check.sct_type == SCT_BTOWER)
break;
}
if (n > 6) {
if (for_real)
pr("%s does not border on water.\n",
xyas(nstr.x, nstr.y, player->cnum));
if (player->god) {
if (for_real)
pr("But if it's what you want...\n");
} else
continue;
}
}
if (sect.sct_type == SCT_SANCT && !player->god)
continue;
n = sect.sct_type;
if ((sect.sct_newtype != des) && (sect.sct_type != des)
&& dchr[des].d_cost) {
&& dchr[des].d_cost > 0) {
if (for_real) {
if (check_cost(!deschar, dchr[des].d_cost, cash, &warned,
player->argp[3]))

View file

@ -48,10 +48,10 @@ struct dchrstr bigcity_dchr = {
struct dchrstr dchr[SCT_MAXDEF + 2] = {
/*
mnem prd mcst flg pkg ostr dstr value $ bld lcm hcm name */
{'.', 0, 0, NAVOK, NPKG, 0.0, 0.0, 0, 0, 0, 0, 0, "sea"},
{'^', P_MDUST, 25, 0, NPKG, 1.0, 4.0, 5, 0, 1, 0, 0, "mountain"},
{'s', 0, 0, 0, NPKG, 0.0, 99.0, 127, 0, 0, 0, 0, "sanctuary"},
{'\\', 0, 0, 0, NPKG, 0.0, 99.0, 0, 0, 0, 0, 0, "wasteland"},
{'.', 0, 0, NAVOK, NPKG, 0.0, 0.0, 0, -1, 0, 0, 0, "sea"},
{'^', P_MDUST, 25, 0, NPKG, 1.0, 4.0, 5, -1, 1, 0, 0, "mountain"},
{'s', 0, 0, 0, NPKG, 0.0, 99.0, 127, -1, 0, 0, 0, "sanctuary"},
{'\\', 0, 0, 0, NPKG, 0.0, 99.0, 0, -1, 0, 0, 0, "wasteland"},
{'-', 0, 3, 0, NPKG, 1.0, 2.0, 1, 0, 0, 0, 0, "wilderness"},
{'c', 0, 2, 0, NPKG, 1.0, 2.0, 30, 0, 1, 0, 0, "capital"},
{'u', P_URAN, 2, 0, NPKG, 1.0, 2.0, 15, 0, 1, 0, 0, "uranium mine"},
@ -76,12 +76,12 @@ struct dchrstr dchr[SCT_MAXDEF + 2] = {
{')', 0, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, "radar installation"},
{'!', 0, 2, 0, NPKG, 1.0, 1.5, 12, 0, 1, 0, 0, "headquarters"},
{'#', 0, 1, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, "bridge head"},
{'=', 0, 1, NAV_60, NPKG, 1.0, 1.0, 5, 0, 1, 0, 0, "bridge span"},
{'=', 0, 1, NAV_60, NPKG, 1.0, 1.0, 5, -1, 1, 0, 0, "bridge span"},
{'b', P_BAR, 2, 0, BPKG, 1.0, 2.25, 10, 0, 1, 0, 0, "bank"},
{'%', P_PETROL, 2, 0, NPKG, 1.0, 1.5, 2, 0, 1, 0, 0, "refinery"},
{'e', 0, 2, 0, NPKG, 1.0, 2.0, 7, 0, 1, 0, 0, "enlistment center"},
{'~', 0, 2, 0, NPKG, 1.0, 1.5, 1, 0, 1, 0, 0, "plains"},
{'@', 0, 1, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, "bridge tower"},
{'~', 0, 2, 0, NPKG, 1.0, 1.5, 1, -1, 1, 0, 0, "plains"},
{'@', 0, 1, 0, NPKG, 1.0, 1.5, 4, -1, 1, 0, 0, "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}
};

View file

@ -627,6 +627,8 @@ show_sect_build(int foo)
for (x = 0; x <= SCT_MAXDEF; x++) {
if (dchr[x].d_mnem == 0)
continue;
if (dchr[x].d_cost < 0)
continue;
if ((dchr[x].d_cost > 0) || (dchr[x].d_build != 1) ||
(dchr[x].d_lcms > 0) || (dchr[x].d_hcms > 0)) {

View file

@ -397,6 +397,14 @@ nullify_objects(void)
dchr[SCT_CAPIT].d_hcms = bigcity_dchr.d_hcms;
dchr[SCT_CAPIT].d_name = bigcity_dchr.d_name;
}
if (opt_NO_LCMS)
dchr[SCT_LIGHT].d_cost = -1;
if (opt_NO_HCMS)
dchr[SCT_HEAVY].d_cost = -1;
if (opt_NO_OIL) {
dchr[SCT_OIL].d_cost = -1;
dchr[SCT_REFINE].d_cost = -1;
}
for (i = 0; i < pln_maxno; i++) {
if (opt_NO_HCMS)
plchr[i].pl_hcm = 0;