]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/cons.c
Update copyright notice
[empserver] / src / lib / commands / cons.c
index d9f2933d7d43cb1798d2e3dce52dc6fb4f3046c7..27fb90f38c617f993139509fbd9460c2d2b9a86d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  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.
  *
  *  ---
  *
  *  cons.c: Consider a loan or treaty
- * 
+ *
  *  Known contributors to this file:
- *     
+ *
  */
 
 #include <config.h>
 
-#include "misc.h"
-#include "player.h"
+#include "commands.h"
 #include "loan.h"
-#include "nat.h"
-#include "treaty.h"
 #include "news.h"
-#include "xy.h"
-#include "nsc.h"
-#include "file.h"
-#include "commands.h"
 #include "optlist.h"
+#include "treaty.h"
 
 /*
  * Things common to a loan or treaty.
 struct ltcomstr {
     int type;                  /* EF_LOAN or EF_TREATY */
     int num;                   /* number */
-    s_char *name;              /* "loan" or "treaty" */
-    s_char *Name;              /* "Loan" or "Treaty" */
+    char *name;                        /* "loan" or "treaty" */
+    char *Name;                        /* "Loan" or "Treaty" */
     natid proposer;            /* country offering */
     natid proposee;            /* country offered to */
     natid mailee;              /* who gets mail about it */
-    s_char op;                 /* 'a', 'd', or 'p' */
+    char op;                   /* 'a', 'd', or 'p' */
     union {
        struct lonstr l;        /* the loan */
        struct trtstr t;        /* the treaty */
@@ -113,11 +107,11 @@ static int
 cons_choose(struct ltcomstr *ltcp)
 {
     static int lon_or_trt[] = { EF_LOAN, EF_TREATY, EF_BAD };
-    s_char *p;
+    char *p;
     struct lonstr *lp;
     struct trtstr *tp;
-    s_char prompt[128];
-    s_char buf[1024];
+    char prompt[128];
+    char buf[1024];
 
     memset(ltcp, 0, sizeof(*ltcp));
     if (getstarg(player->argp[1], "loan or treaty? ", buf) == 0)
@@ -202,8 +196,9 @@ loan_accept(struct ltcomstr *ltcp)
        return RET_OK;
     }
     if (!getloan(ltcp->num, lp)) {
-       pr("loan_accept: can't read loan; get help!\n");
-       return RET_SYS;
+       logerror("loan_accept: can't read loan");
+       pr("can't read loan; get help!\n");
+       return RET_FAIL;
     }
     if (lp->l_status == LS_FREE) {     /* other guy retratcted already */
        late(ltcp);
@@ -256,8 +251,9 @@ loan_decline(struct ltcomstr *ltcp)
 
     lp = &ltcp->u.l;
     if (!getloan(ltcp->num, lp)) {
-       pr("Decline: can't read loan; get help!\n");
-       return RET_SYS;
+       logerror("loan_decline: can't read loan");
+       pr("can't read loan; get help!\n");
+       return RET_FAIL;
     }
     /* loan got accepted somehow between now and last time we checked */
     if (lp->l_status == LS_SIGNED) {
@@ -266,8 +262,9 @@ loan_decline(struct ltcomstr *ltcp)
     }
     lp->l_status = LS_FREE;
     if (!putloan(ltcp->num, lp)) {
-       pr("loan_decline: can't write loan; get help!\n");
-       return RET_SYS;
+       logerror("loan_decline: can't write loan");
+       pr("can't write loan; get help!\n");
+       return RET_FAIL;
     }
     decline(ltcp);
     return RET_OK;
@@ -287,8 +284,9 @@ treaty_accept(struct ltcomstr *ltcp)
        return RET_OK;
     }
     if (!gettre(ltcp->num, tp)) {
-       pr("Accept: can't read treaty; get help!\n");
-       return RET_SYS;
+       pr("treaty_accept: can't read treaty");
+       pr("can't read treaty; get help!\n");
+       return RET_FAIL;
     }
     if (tp->trt_status == TS_FREE) {   /* treaty offer withdrawn */
        late(ltcp);
@@ -300,8 +298,9 @@ treaty_accept(struct ltcomstr *ltcp)
     }
     tp->trt_status = TS_SIGNED;
     if (!puttre(ltcp->num, tp)) {
+       pr("treaty_accept: can't write treaty");
        pr("Problem saving treaty; get help!\n");
-       return RET_SYS;
+       return RET_FAIL;
     }
     accpt(ltcp);
     pr("Treaty in effect until %s", ctime(&tp->trt_exp));
@@ -318,8 +317,9 @@ treaty_decline(struct ltcomstr *ltcp)
 
     tp = &ltcp->u.t;
     if (!gettre(ltcp->num, tp)) {
-       pr("Decline: can't read treaty; get help!\n");
-       return RET_SYS;
+       logerror("treaty_decline: can't read treaty");
+       pr("can't read treaty; get help!\n");
+       return RET_FAIL;
     }
     /* treaty got signed somehow between now and last time we read it */
     if (tp->trt_status == TS_SIGNED) {
@@ -328,8 +328,9 @@ treaty_decline(struct ltcomstr *ltcp)
     }
     tp->trt_status = TS_FREE;
     if (!puttre(ltcp->num, tp)) {
+       logerror("treaty_decline: can't write treaty");
        pr("Problem saving treaty; get help!\n");
-       return RET_SYS;
+       return RET_FAIL;
     }
     decline(ltcp);
     return RET_OK;