Remove option TREATIES
TREATIES has issues: * Treaties can cover attack, assault, paradrop, board, lboard, fire, build (s|p|l|n) and enlist, but not bomb, launch, torpedo and enlistment centers. * Usability is very poor. While a treaty is in effect, every player action that violates a treaty condition triggers a prompt like this: This action is in contravention of treaty #0 (with Curmudgeon) Do you wish to go ahead anyway? [yn] If you decline, the action is not executed. If you accept, it is. In both cases, your decision is reported in the news. You cannot get rid of these prompts until the treaty expires. * Virtually nobody uses them. * Virtually unused code is buggy code. There is at least one race condition: multifire() reads the firing sector, ship or land unit before the treaty prompt, and writes it back after, triggering a generation oops. Any updates made by other threads while trechk() waits for input are wiped out, triggering a seqno mismatch oops. * The treaty prompts could confuse smart clients that aren't prepared for them. WinACE isn't, but is reported to work anyway at least common usage. Ron Koenderink (the WinACE maintainer) suspects there could be a few situations where it will fail. This feature is not earning its keep. Remove it. Drop command treaty, consider treaty, offer treaty, xdump treaty, reject treaties. Output of accept changed, obviously. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
b2090ed34f
commit
a109de948b
60 changed files with 415 additions and 1300 deletions
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
* ---
|
||||
*
|
||||
* offe.c: Offer a loan or treaty
|
||||
* offe.c: Offer a loan
|
||||
*
|
||||
* Known contributors to this file:
|
||||
* Pat Loney, 1992
|
||||
|
@ -36,21 +36,15 @@
|
|||
#include "commands.h"
|
||||
#include "loan.h"
|
||||
#include "optlist.h"
|
||||
#include "treaty.h"
|
||||
|
||||
static int do_treaty(void);
|
||||
static int do_loan(void);
|
||||
|
||||
int
|
||||
offe(void)
|
||||
{
|
||||
char *cp;
|
||||
char buf[1024];
|
||||
|
||||
cp = getstarg(player->argp[1], "loan or treaty? ", buf);
|
||||
if (!cp || !*cp)
|
||||
return RET_SYN;
|
||||
|
||||
cp = player->argp[1] ? player->argp[1] : "loan";
|
||||
switch (*cp) {
|
||||
case 'l':
|
||||
if (!opt_LOANS) {
|
||||
|
@ -58,100 +52,12 @@ offe(void)
|
|||
return RET_FAIL;
|
||||
}
|
||||
return do_loan();
|
||||
case 't':
|
||||
if (!opt_TREATIES) {
|
||||
pr("Treaties are not enabled.\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
return do_treaty();
|
||||
default:
|
||||
pr("You must specify \"loan\" as there are no treaties.\n");
|
||||
pr("You must specify \"loan\".\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
do_treaty(void)
|
||||
{
|
||||
char *cp;
|
||||
int ourcond, theircond;
|
||||
struct symbol *tfp;
|
||||
struct trtstr trty;
|
||||
struct nstr_item nstr;
|
||||
natid recipient;
|
||||
time_t now;
|
||||
int j, n;
|
||||
struct natstr *natp;
|
||||
char prompt[128];
|
||||
char buf[1024];
|
||||
|
||||
if ((n = natarg(player->argp[2], "Treaty offered to? ")) < 0)
|
||||
return RET_SYN;
|
||||
recipient = n;
|
||||
if (recipient == player->cnum) {
|
||||
pr("You can't sign a treaty with yourself!\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
natp = getnatp(recipient);
|
||||
if (player->cnum && (getrejects(player->cnum, natp) & REJ_TREA)) {
|
||||
pr("%s is rejecting your treaties.\n", cname(recipient));
|
||||
return RET_SYN;
|
||||
}
|
||||
pr("Terms for %s:\n", cname(recipient));
|
||||
theircond = 0;
|
||||
for (tfp = treaty_flags; tfp && tfp->name; tfp++) {
|
||||
sprintf(prompt, "%s? ", tfp->name);
|
||||
if (!(cp = getstring(prompt, buf)))
|
||||
return RET_FAIL;
|
||||
if (*cp == 'y')
|
||||
theircond |= tfp->value;
|
||||
}
|
||||
pr("Terms for you:\n");
|
||||
ourcond = 0;
|
||||
for (tfp = treaty_flags; tfp && tfp->name; tfp++) {
|
||||
sprintf(prompt, "%s? ", tfp->name);
|
||||
if (!(cp = getstring(prompt, buf)))
|
||||
return RET_FAIL;
|
||||
if (*cp == 'y')
|
||||
ourcond |= tfp->value;
|
||||
}
|
||||
if (ourcond == 0 && theircond == 0) {
|
||||
pr("Treaties with no clauses aren't very useful, boss!\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
cp = getstring("Proposed treaty duration? (days) ", buf);
|
||||
if (!cp)
|
||||
return RET_FAIL;
|
||||
j = atoi(cp);
|
||||
if (j <= 0) {
|
||||
pr("Bad treaty duration.\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
(void)time(&now);
|
||||
snxtitem_all(&nstr, EF_TREATY);
|
||||
while (nxtitem(&nstr, &trty)) {
|
||||
if (trty.trt_status == TS_FREE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
ef_blank(EF_TREATY, nstr.cur, &trty);
|
||||
trty.trt_acond = ourcond;
|
||||
trty.trt_bcond = theircond;
|
||||
trty.trt_status = TS_PROPOSED;
|
||||
trty.trt_cna = player->cnum;
|
||||
trty.trt_cnb = recipient;
|
||||
trty.trt_exp = j * SECS_PER_DAY + now;
|
||||
if (!puttre(nstr.cur, &trty)) {
|
||||
logerror("do_treaty: can't write treaty");
|
||||
pr("Couldn't save treaty; get help.\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
wu(0, recipient, "Treaty #%d proposed to you by %s\n",
|
||||
nstr.cur, cname(player->cnum));
|
||||
pr("You have proposed treaty #%d\n", nstr.cur);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
do_loan(void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue