Indented with src/scripts/indent-emp.

This commit is contained in:
Markus Armbruster 2003-09-02 20:48:48 +00:00
parent 5f263a7753
commit 9b7adfbecc
437 changed files with 52211 additions and 51052 deletions

View file

@ -52,83 +52,83 @@
int
trechk(register natid actor, register natid victim, int provision)
{
register natid cn;
s_char buf[1024];
int news_verb;
int involved[MAXNOC];
struct trtstr treaty;
time_t now;
int conditions;
natid other;
int broken;
int applied;
struct nstr_item nstr;
register natid cn;
s_char buf[1024];
int news_verb;
int involved[MAXNOC];
struct trtstr treaty;
time_t now;
int conditions;
natid other;
int broken;
int applied;
struct nstr_item nstr;
if (!opt_TREATIES)
return 1;
(void) time(&now);
broken = 0;
applied = 0;
for (cn = 0; cn < MAXNOC; cn++)
involved[cn] = 0;
snxtitem_all(&nstr, EF_TREATY);
while (nxtitem(&nstr, (s_char *)&treaty)) {
if (treaty.trt_status == TS_FREE)
continue;
if (treaty.trt_exp < now)
continue;
if (actor == treaty.trt_cna) {
conditions = treaty.trt_acond;
other = treaty.trt_cnb;
} else if (actor == treaty.trt_cnb) {
conditions = treaty.trt_bcond;
other = treaty.trt_cna;
} else
continue;
if ((conditions & provision) == 0)
continue;
if (victim != other) {
switch (provision) {
/* These are violations no matter who the victim is */
case NEWSHP:
case NEWLND:
case NEWNUK:
case NEWPLN:
case TRTENL:
break;
default:
/* The rest are only violations against the victim */
continue;
}
}
/* treaty applies to actor */
applied++;
pr("This action is in contravention of ");
if (treaty.trt_status == TS_PROPOSED)
pr("pending ");
pr(" treaty #%d (with %s)\n", nstr.cur, cname(other));
getstring("Do you wish to go ahead anyway? [yn] ", buf);
if (*buf == 'n' || *buf == 'N')
broken = 0;
else
broken = 1;
if (treaty.trt_status == TS_SIGNED)
involved[other]++;
}
if (applied > 0) {
news_verb = N_HONOR_TRE;
if (broken > 0)
news_verb = N_VIOL_TRE;
for (cn=0; cn < MAXNOC; cn++)
if (involved[cn] > 0)
nreport(actor, news_verb, cn, 1);
}
if (applied && !broken) {
/*
* if any treaty applied, and none were broken
* the intended action is NOT performed.
*/
return 0;
}
if (!opt_TREATIES)
return 1;
(void)time(&now);
broken = 0;
applied = 0;
for (cn = 0; cn < MAXNOC; cn++)
involved[cn] = 0;
snxtitem_all(&nstr, EF_TREATY);
while (nxtitem(&nstr, (s_char *)&treaty)) {
if (treaty.trt_status == TS_FREE)
continue;
if (treaty.trt_exp < now)
continue;
if (actor == treaty.trt_cna) {
conditions = treaty.trt_acond;
other = treaty.trt_cnb;
} else if (actor == treaty.trt_cnb) {
conditions = treaty.trt_bcond;
other = treaty.trt_cna;
} else
continue;
if ((conditions & provision) == 0)
continue;
if (victim != other) {
switch (provision) {
/* These are violations no matter who the victim is */
case NEWSHP:
case NEWLND:
case NEWNUK:
case NEWPLN:
case TRTENL:
break;
default:
/* The rest are only violations against the victim */
continue;
}
}
/* treaty applies to actor */
applied++;
pr("This action is in contravention of ");
if (treaty.trt_status == TS_PROPOSED)
pr("pending ");
pr(" treaty #%d (with %s)\n", nstr.cur, cname(other));
getstring("Do you wish to go ahead anyway? [yn] ", buf);
if (*buf == 'n' || *buf == 'N')
broken = 0;
else
broken = 1;
if (treaty.trt_status == TS_SIGNED)
involved[other]++;
}
if (applied > 0) {
news_verb = N_HONOR_TRE;
if (broken > 0)
news_verb = N_VIOL_TRE;
for (cn = 0; cn < MAXNOC; cn++)
if (involved[cn] > 0)
nreport(actor, news_verb, cn, 1);
}
if (applied && !broken) {
/*
* if any treaty applied, and none were broken
* the intended action is NOT performed.
*/
return 0;
}
return 1;
}