(sctintrins): New member in_enable. Update infra.config. Use it
instead of opt_DEFENSE_INFRA. (improve): Test for it. (show_sect_build): Show only enabled infrastructure. (opt_DEFENSE_INFRA): Remove. Deities can edit infra.config instead. (improve): Dumb down prompt.
This commit is contained in:
parent
2c2b3f7b1d
commit
4d1dd6fa6a
7 changed files with 79 additions and 29 deletions
|
@ -155,8 +155,6 @@ EMPCF_OPT("BLITZ", opt_BLITZ,
|
||||||
"Enable blitz mode")
|
"Enable blitz mode")
|
||||||
EMPCF_OPT("BRIDGETOWERS", opt_BRIDGETOWERS,
|
EMPCF_OPT("BRIDGETOWERS", opt_BRIDGETOWERS,
|
||||||
"Allow bridge towers")
|
"Allow bridge towers")
|
||||||
EMPCF_OPT("DEFENSE_INFRA", opt_DEFENSE_INFRA,
|
|
||||||
"Allow the improvement of defensive infrastructure")
|
|
||||||
EMPCF_OPT("DEMANDUPDATE", opt_DEMANDUPDATE,
|
EMPCF_OPT("DEMANDUPDATE", opt_DEMANDUPDATE,
|
||||||
"Allow demand updates")
|
"Allow demand updates")
|
||||||
EMPCF_OPT("EASY_BRIDGES", opt_EASY_BRIDGES,
|
EMPCF_OPT("EASY_BRIDGES", opt_EASY_BRIDGES,
|
||||||
|
|
|
@ -172,8 +172,9 @@ extern struct dchrstr bigcity_dchr;
|
||||||
/* Work required for building */
|
/* Work required for building */
|
||||||
#define SCT_BLD_WORK(lcm, hcm) ((lcm) + 2 * (hcm))
|
#define SCT_BLD_WORK(lcm, hcm) ((lcm) + 2 * (hcm))
|
||||||
|
|
||||||
|
/* Return SP's defense efficiency */
|
||||||
#define SCT_DEFENSE(sp) \
|
#define SCT_DEFENSE(sp) \
|
||||||
(opt_DEFENSE_INFRA ? (sp)->sct_defense : (sp)->sct_effic)
|
(intrchr[INT_DEF].in_enable ? (sp)->sct_defense : (sp)->sct_effic)
|
||||||
|
|
||||||
#define FORTEFF 5 /* forts must be 5% efficient to fire. */
|
#define FORTEFF 5 /* forts must be 5% efficient to fire. */
|
||||||
|
|
||||||
|
@ -202,10 +203,11 @@ extern struct dchrstr bigcity_dchr;
|
||||||
/* Each cost is per point of efficency */
|
/* Each cost is per point of efficency */
|
||||||
struct sctintrins {
|
struct sctintrins {
|
||||||
char *in_name;
|
char *in_name;
|
||||||
unsigned char in_lcms;
|
unsigned char in_lcms; /* construction materials */
|
||||||
unsigned char in_hcms;
|
unsigned char in_hcms;
|
||||||
unsigned char in_dcost;
|
unsigned char in_dcost; /* dollars */
|
||||||
unsigned char in_mcost;
|
unsigned char in_mcost; /* mobility */
|
||||||
|
unsigned char in_enable; /* enabled iff non-zero */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct sctintrins intrchr[INT_DEF + 2];
|
extern struct sctintrins intrchr[INT_DEF + 2];
|
||||||
|
|
|
@ -45,11 +45,6 @@
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
|
|
||||||
static char *prompt[] = {
|
|
||||||
"Improve what ('road' or 'rail')? ",
|
|
||||||
"Improve what ('road', 'rail' or 'defense')? "
|
|
||||||
};
|
|
||||||
|
|
||||||
int
|
int
|
||||||
improve(void)
|
improve(void)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +53,7 @@ improve(void)
|
||||||
struct nstr_sect nstr;
|
struct nstr_sect nstr;
|
||||||
char *p;
|
char *p;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char inbuf[128];
|
char prompt[128];
|
||||||
int type;
|
int type;
|
||||||
int value;
|
int value;
|
||||||
int ovalue;
|
int ovalue;
|
||||||
|
@ -70,21 +65,25 @@ improve(void)
|
||||||
int dneeded;
|
int dneeded;
|
||||||
int wanted;
|
int wanted;
|
||||||
|
|
||||||
if (!(p = getstarg(player->argp[1],
|
p = getstarg(player->argp[1],
|
||||||
prompt[!!opt_DEFENSE_INFRA], buf)) || !*p)
|
"Improve what ('road', 'rail' or 'defense')? ",
|
||||||
|
buf);
|
||||||
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!strncmp(p, "ro", 2))
|
if (!strncmp(p, "ro", 2))
|
||||||
type = INT_ROAD;
|
type = INT_ROAD;
|
||||||
else if (!strncmp(p, "ra", 2))
|
else if (!strncmp(p, "ra", 2))
|
||||||
type = INT_RAIL;
|
type = INT_RAIL;
|
||||||
else if (!strncmp(p, "de", 2)) {
|
else if (!strncmp(p, "de", 2)) {
|
||||||
if (!opt_DEFENSE_INFRA) {
|
|
||||||
pr("Defense infrastructure is disabled.\n");
|
|
||||||
return RET_FAIL;
|
|
||||||
}
|
|
||||||
type = INT_DEF;
|
type = INT_DEF;
|
||||||
} else
|
} else
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
|
if (!intrchr[type].in_enable) {
|
||||||
|
pr("%s improvement is disabled.\n", intrchr[type].in_name);
|
||||||
|
return RET_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!snxtsct(&nstr, player->argp[2]))
|
if (!snxtsct(&nstr, player->argp[2]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
prdate();
|
prdate();
|
||||||
|
@ -98,10 +97,10 @@ improve(void)
|
||||||
value = sect.sct_rail;
|
value = sect.sct_rail;
|
||||||
else /* type == INT_DEF */
|
else /* type == INT_DEF */
|
||||||
value = sect.sct_defense;
|
value = sect.sct_defense;
|
||||||
sprintf(inbuf, "Sector %s has a %s of %d%%. Improve how much? ",
|
sprintf(prompt, "Sector %s has a %s of %d%%. Improve how much? ",
|
||||||
xyas(sect.sct_x, sect.sct_y, player->cnum),
|
xyas(sect.sct_x, sect.sct_y, player->cnum),
|
||||||
intrchr[type].in_name, value);
|
intrchr[type].in_name, value);
|
||||||
if (!(p = getstarg(player->argp[3], inbuf, buf)) || !*p)
|
if (!(p = getstarg(player->argp[3], prompt, buf)) || !*p)
|
||||||
continue;
|
continue;
|
||||||
if (!check_sect_ok(§))
|
if (!check_sect_ok(§))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1,6 +1,50 @@
|
||||||
|
#
|
||||||
|
# Empire - A multi-player, client/server Internet based war game.
|
||||||
|
# Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
|
||||||
|
# Ken Stevens, Steve McClure
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# See files README, COPYING and CREDITS in the root of the source
|
||||||
|
# tree for related information and legal notices. It is expected
|
||||||
|
# that future projects/authors will amend these files as needed.
|
||||||
|
#
|
||||||
|
# ---
|
||||||
|
#
|
||||||
|
# infra.config: Infrastructure characteristics
|
||||||
|
#
|
||||||
|
# Known contributors to this file:
|
||||||
|
# Markus Armbruster, 2006
|
||||||
|
#
|
||||||
|
# Derived from sect.c; known contributors:
|
||||||
|
# Dave Pare, 1986
|
||||||
|
# Jeff Bailey
|
||||||
|
# Thomas Ruschak, 1992
|
||||||
|
# Ken Stevens, 1995
|
||||||
|
# Steve McClure, 1998
|
||||||
|
#
|
||||||
|
|
||||||
|
# Do not edit this file to customize a game! Create your own custom
|
||||||
|
# configuration file(s), best next to your econfig, and name them in
|
||||||
|
# econfig key custom_tables.
|
||||||
|
|
||||||
config infrastructure
|
config infrastructure
|
||||||
name lcm hcm dcost mcost
|
name lcm hcm dcost mcost enab
|
||||||
"road network" 2 2 2 1
|
"road network" 2 2 2 1 1
|
||||||
"rail network" 1 1 1 1
|
"rail network" 1 1 1 1 1
|
||||||
"defense factor" 1 1 1 1
|
"defense factor" 1 1 1 1 0
|
||||||
/config
|
/config
|
||||||
|
|
|
@ -567,6 +567,8 @@ struct castr intrchr_ca[] = {
|
||||||
{NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_hcms), "hcms", EF_BAD},
|
{NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_hcms), "hcms", EF_BAD},
|
||||||
{NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_dcost), "dcost", EF_BAD},
|
{NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_dcost), "dcost", EF_BAD},
|
||||||
{NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_mcost), "mcost", EF_BAD},
|
{NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_mcost), "mcost", EF_BAD},
|
||||||
|
{NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_enable), "enable",
|
||||||
|
EF_BAD},
|
||||||
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
|
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
int opt_ALL_BLEED = 1;
|
int opt_ALL_BLEED = 1;
|
||||||
int opt_BLITZ = 1;
|
int opt_BLITZ = 1;
|
||||||
int opt_BRIDGETOWERS = 1;
|
int opt_BRIDGETOWERS = 1;
|
||||||
int opt_DEFENSE_INFRA = 0;
|
|
||||||
int opt_DEMANDUPDATE = 1;
|
int opt_DEMANDUPDATE = 1;
|
||||||
int opt_EASY_BRIDGES = 1;
|
int opt_EASY_BRIDGES = 1;
|
||||||
int opt_FALLOUT = 1;
|
int opt_FALLOUT = 1;
|
||||||
|
|
|
@ -496,8 +496,9 @@ show_land_stats(int tlev)
|
||||||
void
|
void
|
||||||
show_sect_build(int foo)
|
show_sect_build(int foo)
|
||||||
{
|
{
|
||||||
int x, first = 1;
|
int x, first;
|
||||||
|
|
||||||
|
first = 1;
|
||||||
for (x = 0; x <= SCT_MAXDEF; x++) {
|
for (x = 0; x <= SCT_MAXDEF; x++) {
|
||||||
if (dchr[x].d_mnem == 0)
|
if (dchr[x].d_mnem == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -514,13 +515,18 @@ show_sect_build(int foo)
|
||||||
dchr[x].d_lcms, dchr[x].d_hcms);
|
dchr[x].d_lcms, dchr[x].d_hcms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pr("\n");
|
|
||||||
pr("Infrastructure building - adding 1 point of efficiency costs:\n");
|
first = 1;
|
||||||
pr(" type lcms hcms mobility $$$$\n");
|
|
||||||
for (x = 0; intrchr[x].in_name; x++) {
|
for (x = 0; intrchr[x].in_name; x++) {
|
||||||
|
if (!intrchr[x].in_enable)
|
||||||
|
continue;
|
||||||
|
if (first)
|
||||||
|
pr("\nInfrastructure building - adding 1 point of efficiency costs:\n"
|
||||||
|
" type lcms hcms mobility $$$$\n");
|
||||||
pr("%-20s %4d %4d %8d %4d\n",
|
pr("%-20s %4d %4d %8d %4d\n",
|
||||||
intrchr[x].in_name, intrchr[x].in_lcms, intrchr[x].in_hcms,
|
intrchr[x].in_name, intrchr[x].in_lcms, intrchr[x].in_hcms,
|
||||||
intrchr[x].in_mcost, intrchr[x].in_dcost);
|
intrchr[x].in_mcost, intrchr[x].in_dcost);
|
||||||
|
first = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue