(tchrstr, tchr_ca): Remove, use struct symbol and symbol_ca. Users
changed. (tchr, treaty_flags): Rename for consistency with other flags.
This commit is contained in:
parent
02ec5df820
commit
e612db5cb6
7 changed files with 17 additions and 31 deletions
|
@ -81,7 +81,7 @@ do_treaty(void)
|
|||
register int ourcond;
|
||||
register int theircond;
|
||||
register int j;
|
||||
struct tchrstr *tcp;
|
||||
struct symbol *tfp;
|
||||
struct trtstr trty;
|
||||
struct nstr_item nstr;
|
||||
natid recipient;
|
||||
|
@ -105,21 +105,21 @@ do_treaty(void)
|
|||
}
|
||||
pr("Terms for %s:\n", cname(recipient));
|
||||
theircond = 0;
|
||||
for (tcp = tchr; tcp && tcp->t_cond; tcp++) {
|
||||
sprintf(prompt, "%s? ", tcp->t_name);
|
||||
for (tfp = treaty_flags; tfp && tfp->name; tfp++) {
|
||||
sprintf(prompt, "%s? ", tfp->name);
|
||||
if ((cp = getstring(prompt, buf)) == 0)
|
||||
return RET_FAIL;
|
||||
if (*cp == 'y')
|
||||
theircond |= tcp->t_cond;
|
||||
theircond |= tfp->value;
|
||||
}
|
||||
pr("Terms for you:\n");
|
||||
ourcond = 0;
|
||||
for (tcp = tchr; tcp && tcp->t_cond; tcp++) {
|
||||
sprintf(prompt, "%s? ", tcp->t_name);
|
||||
for (tfp = treaty_flags; tfp && tfp->name; tfp++) {
|
||||
sprintf(prompt, "%s? ", tfp->name);
|
||||
if ((cp = getstring(prompt, buf)) == 0)
|
||||
return RET_FAIL;
|
||||
if (*cp == 'y')
|
||||
ourcond |= tcp->t_cond;
|
||||
ourcond |= tfp->value;
|
||||
}
|
||||
if (ourcond == 0 && theircond == 0) {
|
||||
pr("Treaties with no clauses aren't very useful, boss!\n");
|
||||
|
|
|
@ -122,9 +122,9 @@ struct empfile empfile[] = {
|
|||
{EF_NEWS_CHR, "news chr", NULL, EFF_CFG,
|
||||
sizeof(rpt[0]), NULL, NULL, NULL,
|
||||
-1, -1, 0, 0, (char *)rpt, 0, rpt_ca},
|
||||
{EF_TREATY_CHR, "treaty chr", NULL, EFF_CFG,
|
||||
sizeof(tchr[0]), NULL, NULL, NULL,
|
||||
-1, -1, 0, 0, (char *)tchr, 0, tchr_ca},
|
||||
{EF_TREATY_CHR, "treaty flags", NULL, EFF_CFG,
|
||||
sizeof(treaty_flags[0]), NULL, NULL, NULL,
|
||||
-1, -1, 0, 0, (char *)treaty_flags, 0, symbol_ca},
|
||||
{EF_ITEM, "item", NULL, EFF_CFG,
|
||||
sizeof(ichr[0]), NULL, NULL, NULL,
|
||||
-1, -1, 0, 0, (char *)ichr, 0, ichr_ca},
|
||||
|
|
|
@ -373,12 +373,6 @@ struct castr treaty_ca[] = {
|
|||
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
|
||||
};
|
||||
|
||||
struct castr tchr_ca[] = {
|
||||
{NSC_STRING, 0, 0, offsetof(struct tchrstr, t_name), "name", EF_BAD},
|
||||
{NSC_INT, 0, 0, offsetof(struct tchrstr, t_cond), "cond", EF_BAD},
|
||||
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
|
||||
};
|
||||
|
||||
struct castr loan_ca[] = {
|
||||
{NSC_NATID, 0, 0, fldoff(lonstr, l_loner), "loaner", EF_BAD},
|
||||
{NSC_SHORT, 0, 0, fldoff(lonstr, l_uid), "uid", EF_BAD},
|
||||
|
|
|
@ -33,9 +33,10 @@
|
|||
*/
|
||||
|
||||
#include "misc.h"
|
||||
#include "nsc.h"
|
||||
#include "treaty.h"
|
||||
|
||||
struct tchrstr tchr[] = {
|
||||
struct symbol treaty_flags[] = {
|
||||
{LNDATT, "no attacks on any land units"},
|
||||
{SEAATT, "no attacks on any ships"},
|
||||
{SEAFIR, "no shelling any ships"},
|
||||
|
@ -47,5 +48,5 @@ struct tchrstr tchr[] = {
|
|||
{NEWPLN, "no building planes"},
|
||||
{NEWLND, "no building land units"},
|
||||
{TRTENL, "no enlistment"},
|
||||
{0, 0}
|
||||
{0, NULL}
|
||||
};
|
||||
|
|
|
@ -69,16 +69,16 @@ distrea(int n, register struct trtstr *tp)
|
|||
pr("%s expires %s", cname(tp->trt_cnb), ctime(&tp->trt_exp));
|
||||
pr("%24.24s terms", cname(tp->trt_cna));
|
||||
pr(" - %s terms\n", cname(tp->trt_cnb));
|
||||
for (i = 0; 0 != (cond = tchr[i].t_cond); i++) {
|
||||
for (i = 0; 0 != (cond = treaty_flags[i].value); i++) {
|
||||
acond = tp->trt_acond & cond;
|
||||
bcond = tp->trt_bcond & cond;
|
||||
if (acond | bcond) {
|
||||
if (acond)
|
||||
pr("%30s", tchr[i].t_name);
|
||||
pr("%30s", treaty_flags[i].name);
|
||||
else
|
||||
pr("%30s", "");
|
||||
if (bcond)
|
||||
pr(" - %s\n", tchr[i].t_name);
|
||||
pr(" - %s\n", treaty_flags[i].name);
|
||||
else
|
||||
pr(" -\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue