changed.
(tchr, treaty_flags): Rename for consistency with other flags.
extern struct castr nuke_ca[];
extern struct castr nchr_ca[];
extern struct castr treaty_ca[];
-extern struct castr tchr_ca[];
extern struct castr loan_ca[];
extern struct castr news_ca[];
extern struct castr lost_ca[];
extern struct symbol plane_chr_flags[];
extern struct symbol land_chr_flags[];
extern struct symbol nuke_chr_flags[];
+extern struct symbol treaty_flags[];
extern struct castr mdchr_ca[];
extern struct symbol meta_type[];
extern struct symbol meta_flags[];
time_t trt_exp; /* expiration date */
};
-struct tchrstr {
- int t_cond; /* bit to indicate this clause */
- char *t_name; /* description of clause */
-};
-
#define TS_FREE 0
#define TS_PROPOSED 1
#define TS_SIGNED 2
#define TRTENL bit(9) /* no enlistment */
#define SUBFIR bit(10) /* no depth-charging submarines */
-/* global treaty variables */
-
#define gettre(n, p) \
ef_read(EF_TREATY, n, p)
#define puttre(n, p) \
#define gettrep(n) \
(struct trtstr *) ef_ptr(EF_TREATY, n)
-extern struct tchrstr tchr[];
-
#endif /* _TREATY_H_ */
register int ourcond;
register int theircond;
register int j;
- struct tchrstr *tcp;
+ struct symbol *tfp;
struct trtstr trty;
struct nstr_item nstr;
natid recipient;
}
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");
{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},
{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},
*/
#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"},
{NEWPLN, "no building planes"},
{NEWLND, "no building land units"},
{TRTENL, "no enlistment"},
- {0, 0}
+ {0, NULL}
};
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");
}