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
54
doc/xdump
54
doc/xdump
|
@ -310,13 +310,13 @@ Let's explore how to dump a game. To make sense of a table, we need
|
||||||
its meta-data, and to make sense of that table, we need meta-meta
|
its meta-data, and to make sense of that table, we need meta-meta
|
||||||
data. So we start with that:
|
data. So we start with that:
|
||||||
|
|
||||||
[14:640] Command : xdump meta meta
|
[3:640] Command : xdump meta meta
|
||||||
XDUMP meta meta 1303706667
|
XDUMP meta meta 1391339695
|
||||||
"name" 3 4 0 -1
|
"name" 3 4 0 -1
|
||||||
"type" 4 4 0 34
|
"type" 8 4 0 33
|
||||||
"flags" 5 12 0 33
|
"flags" 8 12 0 32
|
||||||
"len" 7 4 0 -1
|
"len" 7 4 0 -1
|
||||||
"table" 8 4 0 27
|
"table" 8 4 0 26
|
||||||
/5
|
/5
|
||||||
|
|
||||||
To interpret this table, we have to know the field names and their
|
To interpret this table, we have to know the field names and their
|
||||||
|
@ -339,9 +339,9 @@ type only for tables we don't know, and there's one more table we do
|
||||||
know, namely the table of tables. Let's dump that next, starting with
|
know, namely the table of tables. Let's dump that next, starting with
|
||||||
its meta-data:
|
its meta-data:
|
||||||
|
|
||||||
[31:640] Command : xdump meta table
|
[3:640] Command : xdump meta table
|
||||||
XDUMP meta table 1303706678
|
XDUMP meta table 1391339775
|
||||||
"uid" 8 0 0 27
|
"uid" 8 0 0 26
|
||||||
"name" 3 4 0 -1
|
"name" 3 4 0 -1
|
||||||
/2
|
/2
|
||||||
|
|
||||||
|
@ -351,33 +351,33 @@ leftmost field's meta-data field table must be the table ID of xdump
|
||||||
table itself. Indeed, its value matches the one we got in xdump meta
|
table itself. Indeed, its value matches the one we got in xdump meta
|
||||||
meta. Let's try to dump the table:
|
meta. Let's try to dump the table:
|
||||||
|
|
||||||
[30:640] Command : xdump 27 *
|
[5:640] Command : xdump 26 *
|
||||||
XDUMP table 1303706692
|
XDUMP table 1391339794
|
||||||
0 "sect"
|
0 "sect"
|
||||||
1 "ship"
|
1 "ship"
|
||||||
[...]
|
[...]
|
||||||
9 "nat"
|
8 "nat"
|
||||||
[...]
|
[...]
|
||||||
19 "sect-chr"
|
18 "sect-chr"
|
||||||
20 "ship-chr"
|
19 "ship-chr"
|
||||||
[...]
|
[...]
|
||||||
27 "table"
|
26 "table"
|
||||||
[...]
|
[...]
|
||||||
/49
|
/47
|
||||||
|
|
||||||
It worked!
|
It worked!
|
||||||
|
|
||||||
Now dump the two symbol tables we postponed. Because xdump accepts
|
Now dump the two symbol tables we postponed. Because xdump accepts
|
||||||
table IDs as well as names, we don't have to know their names:
|
table IDs as well as names, we don't have to know their names:
|
||||||
|
|
||||||
[14:640] Command : xdump meta 34
|
[5:640] Command : xdump meta 33
|
||||||
XDUMP meta meta-type 1303706718
|
XDUMP meta meta-type 1391339879
|
||||||
"value" 8 4 0 -1
|
"value" 8 4 0 -1
|
||||||
"name" 3 4 0 -1
|
"name" 3 4 0 -1
|
||||||
/2
|
/2
|
||||||
|
|
||||||
[15:640] Command : xdump 34 *
|
[6:640] Command : xdump 33 *
|
||||||
XDUMP meta-type 1303706737
|
XDUMP meta-type 1391339892
|
||||||
1 "d"
|
1 "d"
|
||||||
2 "g"
|
2 "g"
|
||||||
3 "s"
|
3 "s"
|
||||||
|
@ -394,14 +394,14 @@ table IDs as well as names, we don't have to know their names:
|
||||||
14 "c"
|
14 "c"
|
||||||
/14
|
/14
|
||||||
|
|
||||||
[15:640] Command : xdump meta 33
|
[7:640] Command : xdump meta 32
|
||||||
XDUMP meta meta-flags 1303706753
|
XDUMP meta meta-flags 1391339904
|
||||||
"value" 8 4 0 -1
|
"value" 8 4 0 -1
|
||||||
"name" 3 4 0 -1
|
"name" 3 4 0 -1
|
||||||
/2
|
/2
|
||||||
|
|
||||||
[24:640] Command : xdump 33 *
|
[7:640] Command : xdump 32 *
|
||||||
XDUMP meta-flags 1303706765
|
XDUMP meta-flags 1391339919
|
||||||
1 "deity"
|
1 "deity"
|
||||||
2 "extra"
|
2 "extra"
|
||||||
4 "const"
|
4 "const"
|
||||||
|
@ -421,12 +421,12 @@ We now have complete meta-meta information:
|
||||||
Dumping the remaining tables is easy: just walk the table of tables.
|
Dumping the remaining tables is easy: just walk the table of tables.
|
||||||
Here's the first one:
|
Here's the first one:
|
||||||
|
|
||||||
[36:640] Command : xdump meta 0
|
[7:640] Command : xdump meta 0
|
||||||
XDUMP meta sect 1303706822
|
XDUMP meta sect 1391339937
|
||||||
"owner" 5 0 0 9
|
"owner" 5 0 0 8
|
||||||
"xloc" 9 4 0 -1
|
"xloc" 9 4 0 -1
|
||||||
"yloc" 10 4 0 -1
|
"yloc" 10 4 0 -1
|
||||||
"des" 4 0 0 19
|
"des" 4 0 0 18
|
||||||
[...]
|
[...]
|
||||||
/78
|
/78
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ extern int att_combat_init(struct combat *, int);
|
||||||
extern int att_get_combat(struct combat *, int);
|
extern int att_get_combat(struct combat *, int);
|
||||||
extern int att_abort(int, struct combat *, struct combat *);
|
extern int att_abort(int, struct combat *, struct combat *);
|
||||||
extern int att_approach(struct combat *, struct combat *);
|
extern int att_approach(struct combat *, struct combat *);
|
||||||
extern int att_show(struct combat *);
|
extern void att_show(struct combat *);
|
||||||
extern int att_ask_support(int, int *, int *, int *, int *);
|
extern int att_ask_support(int, int *, int *, int *, int *);
|
||||||
extern int att_ask_offense(int, struct combat *, struct combat *,
|
extern int att_ask_offense(int, struct combat *, struct combat *,
|
||||||
struct emp_qelem *, int *, int *);
|
struct emp_qelem *, int *, int *);
|
||||||
|
|
|
@ -195,8 +195,6 @@ EMPCF_OPT("SUPER_BARS", opt_SUPER_BARS,
|
||||||
"Make bars immune to damage")
|
"Make bars immune to damage")
|
||||||
EMPCF_OPT("TECH_POP", opt_TECH_POP,
|
EMPCF_OPT("TECH_POP", opt_TECH_POP,
|
||||||
"Technology costs more as population rises")
|
"Technology costs more as population rises")
|
||||||
EMPCF_OPT("TREATIES", opt_TREATIES,
|
|
||||||
"Allow treaties")
|
|
||||||
|
|
||||||
EMPCF_COMMENT("\n\n### Countries")
|
EMPCF_COMMENT("\n\n### Countries")
|
||||||
EMPCFBOTH("btu_build_rate", btu_build_rate, float, NSC_FLOAT, 0,
|
EMPCFBOTH("btu_build_rate", btu_build_rate, float, NSC_FLOAT, 0,
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
#include "sect.h"
|
#include "sect.h"
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
#include "trade.h"
|
#include "trade.h"
|
||||||
#include "treaty.h"
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
struct empobj {
|
struct empobj {
|
||||||
|
@ -89,7 +88,6 @@ union empobj_storage {
|
||||||
struct sctstr sect;
|
struct sctstr sect;
|
||||||
struct shpstr ship;
|
struct shpstr ship;
|
||||||
struct trdstr trade;
|
struct trdstr trade;
|
||||||
struct trtstr treaty;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct empobj_chr;
|
struct empobj_chr;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
struct empfile {
|
struct empfile {
|
||||||
/* Members with immutable values */
|
/* Members with immutable values */
|
||||||
int uid; /* Table ID */
|
int uid; /* Table ID */
|
||||||
char *name; /* Empire name (e.g., "treaty") */
|
char *name; /* Empire name (e.g., "land") */
|
||||||
char *pretty_name; /* prettier name, e.g. "land unit" */
|
char *pretty_name; /* prettier name, e.g. "land unit" */
|
||||||
char *file; /* file name, relative to gamedir for
|
char *file; /* file name, relative to gamedir for
|
||||||
game state, to builtindir for config */
|
game state, to builtindir for config */
|
||||||
|
@ -146,7 +146,6 @@ enum {
|
||||||
EF_LAND,
|
EF_LAND,
|
||||||
EF_NUKE,
|
EF_NUKE,
|
||||||
EF_NEWS,
|
EF_NEWS,
|
||||||
EF_TREATY,
|
|
||||||
EF_TRADE,
|
EF_TRADE,
|
||||||
EF_POWER,
|
EF_POWER,
|
||||||
EF_NATION,
|
EF_NATION,
|
||||||
|
@ -194,7 +193,6 @@ enum {
|
||||||
EF_RETREAT_FLAGS,
|
EF_RETREAT_FLAGS,
|
||||||
EF_SECTOR_NAVIGATION,
|
EF_SECTOR_NAVIGATION,
|
||||||
EF_SHIP_CHR_FLAGS,
|
EF_SHIP_CHR_FLAGS,
|
||||||
EF_TREATY_FLAGS,
|
|
||||||
/* Views */
|
/* Views */
|
||||||
EF_COUNTRY,
|
EF_COUNTRY,
|
||||||
/* Number of types: */
|
/* Number of types: */
|
||||||
|
|
|
@ -126,9 +126,8 @@ struct natstr {
|
||||||
|
|
||||||
/* nation reject codes */
|
/* nation reject codes */
|
||||||
#define REJ_TELE bit(0) /* dont allow telegrams to be sent */
|
#define REJ_TELE bit(0) /* dont allow telegrams to be sent */
|
||||||
#define REJ_TREA bit(1) /* dont allow treaties to be offered */
|
#define REJ_ANNO bit(1) /* don't receive announcements */
|
||||||
#define REJ_ANNO bit(2) /* don't receive announcements */
|
#define REJ_LOAN bit(2) /* don't allow loans to be offered */
|
||||||
#define REJ_LOAN bit(3) /* don't allow loans to be offered */
|
|
||||||
|
|
||||||
#define NAT_TLEV 0
|
#define NAT_TLEV 0
|
||||||
#define NAT_RLEV 1
|
#define NAT_RLEV 1
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct rptstr {
|
||||||
#define N_SCT_LOSE 2
|
#define N_SCT_LOSE 2
|
||||||
#define N_SPY_SHOT 3
|
#define N_SPY_SHOT 3
|
||||||
#define N_SENT_TEL 4
|
#define N_SENT_TEL 4
|
||||||
#define N_SIGN_TRE 5
|
/* unused 5 */
|
||||||
#define N_MAKE_LOAN 6
|
#define N_MAKE_LOAN 6
|
||||||
#define N_REPAY_LOAN 7
|
#define N_REPAY_LOAN 7
|
||||||
#define N_MAKE_SALE 8
|
#define N_MAKE_SALE 8
|
||||||
|
@ -83,8 +83,8 @@ struct rptstr {
|
||||||
#define N_SHP_LOSE 19
|
#define N_SHP_LOSE 19
|
||||||
/* unused 20 */
|
/* unused 20 */
|
||||||
#define N_SEIZE_SECT 21
|
#define N_SEIZE_SECT 21
|
||||||
#define N_HONOR_TRE 22
|
/* unused 22 */
|
||||||
#define N_VIOL_TRE 23
|
/* unused 23 */
|
||||||
/* unused 24 */
|
/* unused 24 */
|
||||||
#define N_HIT_MINE 25
|
#define N_HIT_MINE 25
|
||||||
#define N_DECL_ALLY 26
|
#define N_DECL_ALLY 26
|
||||||
|
|
|
@ -246,7 +246,6 @@ extern struct castr land_ca[];
|
||||||
extern struct castr lchr_ca[];
|
extern struct castr lchr_ca[];
|
||||||
extern struct castr nuke_ca[];
|
extern struct castr nuke_ca[];
|
||||||
extern struct castr nchr_ca[];
|
extern struct castr nchr_ca[];
|
||||||
extern struct castr treaty_ca[];
|
|
||||||
extern struct castr loan_ca[];
|
extern struct castr loan_ca[];
|
||||||
extern struct castr news_ca[];
|
extern struct castr news_ca[];
|
||||||
extern struct castr lost_ca[];
|
extern struct castr lost_ca[];
|
||||||
|
@ -265,7 +264,6 @@ extern struct symbol ship_chr_flags[];
|
||||||
extern struct symbol plane_chr_flags[];
|
extern struct symbol plane_chr_flags[];
|
||||||
extern struct symbol land_chr_flags[];
|
extern struct symbol land_chr_flags[];
|
||||||
extern struct symbol nuke_chr_flags[];
|
extern struct symbol nuke_chr_flags[];
|
||||||
extern struct symbol treaty_flags[];
|
|
||||||
extern struct castr mdchr_ca[];
|
extern struct castr mdchr_ca[];
|
||||||
extern struct symbol meta_type[];
|
extern struct symbol meta_type[];
|
||||||
extern struct symbol meta_flags[];
|
extern struct symbol meta_flags[];
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
/*
|
|
||||||
* Empire - A multi-player, client/server Internet based war game.
|
|
||||||
* Copyright (C) 1986-2014, Dave Pare, Jeff Bailey, Thomas Ruschak,
|
|
||||||
* Ken Stevens, Steve McClure, Markus Armbruster
|
|
||||||
*
|
|
||||||
* Empire is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* treaty.h: Definitions for treaties
|
|
||||||
*
|
|
||||||
* Known contributors to this file:
|
|
||||||
* Steve McClure, 1998
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef TREATY_H
|
|
||||||
#define TREATY_H
|
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
struct trtstr {
|
|
||||||
/* initial part must match struct empobj */
|
|
||||||
signed ef_type: 8;
|
|
||||||
unsigned trt_seqno: 12;
|
|
||||||
unsigned trt_generation: 12;
|
|
||||||
int trt_uid;
|
|
||||||
time_t trt_timestamp;
|
|
||||||
/* end of part matching struct empobj */
|
|
||||||
natid trt_cna; /* proposer */
|
|
||||||
natid trt_cnb; /* acceptor */
|
|
||||||
signed char trt_status; /* treaty status */
|
|
||||||
char trt_fill;
|
|
||||||
short trt_acond; /* conditions for proposer */
|
|
||||||
short trt_bcond; /* conditions for accepter */
|
|
||||||
time_t trt_exp; /* expiration date */
|
|
||||||
};
|
|
||||||
|
|
||||||
#define TS_FREE AGREE_FREE
|
|
||||||
#define TS_PROPOSED AGREE_PROPOSED
|
|
||||||
#define TS_SIGNED AGREE_SIGNED
|
|
||||||
|
|
||||||
/* treaty clauses */
|
|
||||||
#define LNDATT bit(0) /* no attacks on land units */
|
|
||||||
#define SEAATT bit(1) /* no attacks on ships */
|
|
||||||
#define SEAFIR bit(2) /* no shelling ships */
|
|
||||||
#define LANATT bit(3) /* no attacks on sectors */
|
|
||||||
#define LANFIR bit(4) /* no shelling sectors */
|
|
||||||
#define NEWSHP bit(5) /* no new ships */
|
|
||||||
#define NEWNUK bit(6) /* no new nuclear weapons */
|
|
||||||
#define NEWPLN bit(7) /* no new planes */
|
|
||||||
#define NEWLND bit(8) /* no new land units */
|
|
||||||
#define TRTENL bit(9) /* no enlistment */
|
|
||||||
#define SUBFIR bit(10) /* no depth-charging submarines */
|
|
||||||
|
|
||||||
#define gettre(n, p) ef_read(EF_TREATY, (n), (p))
|
|
||||||
#define puttre(n, p) ef_write(EF_TREATY, (n), (p))
|
|
||||||
#define gettrep(n) ((struct trtstr *)ef_ptr(EF_TREATY, (n)))
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -528,10 +528,6 @@ I was talking to Lewis from Cornell College
|
||||||
and his comment was the best I'd heard in a while:
|
and his comment was the best I'd heard in a while:
|
||||||
\*QNever ally with someone that doesn't have a definite
|
\*QNever ally with someone that doesn't have a definite
|
||||||
interest in seeing you survive.\*U
|
interest in seeing you survive.\*U
|
||||||
Don't be deceived by the treaty command;
|
|
||||||
treaty violations will show up in the news,
|
|
||||||
but that is not going to stop the aggressor from wiping you out,
|
|
||||||
no matter how bad it looks in the news.
|
|
||||||
.s1
|
.s1
|
||||||
Nuclear attacks can cause a lot of damage,
|
Nuclear attacks can cause a lot of damage,
|
||||||
but no one has ever been taken out of the game by a nuclear attack.
|
but no one has ever been taken out of the game by a nuclear attack.
|
||||||
|
|
|
@ -40,8 +40,6 @@ NO_FORT_FIRE: Forts cannot fire.
|
||||||
RAILWAYS Highways double as rail
|
RAILWAYS Highways double as rail
|
||||||
TECH_POP: Technology costs more to make as your civilian population
|
TECH_POP: Technology costs more to make as your civilian population
|
||||||
grows past 50,000 civilians.
|
grows past 50,000 civilians.
|
||||||
TREATIES: Sign treaties with your friends and enemies, and breaking of
|
|
||||||
them is reported in the news.
|
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
.SA "Hidden, Server, version"
|
.SA "Hidden, Server, version"
|
||||||
|
|
|
@ -231,16 +231,6 @@ Deity:
|
||||||
.L mines
|
.L mines
|
||||||
.in
|
.in
|
||||||
.s1
|
.s1
|
||||||
Treaty:
|
|
||||||
.in +\w'nchoppers\0\0'u
|
|
||||||
.L cna
|
|
||||||
.L cnb
|
|
||||||
.L status
|
|
||||||
.L acond
|
|
||||||
.L bcond
|
|
||||||
.L exp
|
|
||||||
.in
|
|
||||||
.s1
|
|
||||||
Loan:
|
Loan:
|
||||||
.in +\w'nchoppers\0\0'u
|
.in +\w'nchoppers\0\0'u
|
||||||
.L loaner
|
.L loaner
|
||||||
|
|
|
@ -8,16 +8,16 @@ it prints the acceptance status of the specified country.
|
||||||
.s1
|
.s1
|
||||||
.EX "accept 7"
|
.EX "accept 7"
|
||||||
.nf
|
.nf
|
||||||
Temekula Acceptance Status Report Sun Feb 21 20:53:51 1993
|
Temekula Acceptance Status Report Sat Jan 11 17:02:53 2014
|
||||||
|
|
||||||
Acceptance status his theirs
|
Acceptance status his theirs
|
||||||
tel trty anno loan tel trty anno loan
|
tel anno loan tel anno loan
|
||||||
1) Gobu YES YES YES YES YES YES YES YES
|
1) Gobu YES YES YES YES YES YES
|
||||||
2) Spectre YES YES YES YES YES YES YES YES
|
2) Spectre YES YES YES YES YES YES
|
||||||
3) Rohan YES YES YES YES YES YES YES YES
|
3) Rohan YES YES YES YES YES YES
|
||||||
4) Sioux YES YES YES YES YES YES YES YES
|
4) Sioux YES YES YES YES YES YES
|
||||||
5) Tom_Servo YES YES YES YES YES YES YES YES
|
5) Tom_Servo YES YES YES YES YES YES
|
||||||
6) Horgoth YES YES YES YES YES YES YES YES
|
6) Horgoth YES YES YES YES YES YES
|
||||||
.fi
|
.fi
|
||||||
.s1
|
.s1
|
||||||
.SA "telegram, announce, read, wire, reject, Diplomacy, Communication"
|
.SA "telegram, announce, read, wire, reject, Diplomacy, Communication"
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
.TH Command CONSIDER
|
.TH Command CONSIDER
|
||||||
.NA consider "Accept, decline or postpone consideration of a loan or treaty"
|
.NA consider "Accept, decline or postpone consideration of a loan"
|
||||||
.LV Expert
|
.LV Expert
|
||||||
.SY "consider loan <loan #> accept|decline|postpone"
|
.SY "consider loan <loan #> accept|decline|postpone"
|
||||||
.SY "consider treaty <treaty #> accept|decline|postpone"
|
This command allows you to consider accepting a loan
|
||||||
This command allows you to consider accepting a loan or treaty
|
|
||||||
offered by another country.
|
offered by another country.
|
||||||
.s1
|
.s1
|
||||||
The program will list the various terms of the loan or treaty
|
The program will list the various terms of the loan
|
||||||
under consideration and ask for your decision
|
under consideration and ask for your decision
|
||||||
as to whether to accept the terms, decline them,
|
as to whether to accept the terms, decline them,
|
||||||
or postpone making a decision.
|
or postpone making a decision.
|
||||||
|
@ -18,20 +17,13 @@ If at the time of your acceptance,
|
||||||
the lender does not have sufficient funds the size of the loan
|
the lender does not have sufficient funds the size of the loan
|
||||||
will be diminished to fit the lender's cash on hand.
|
will be diminished to fit the lender's cash on hand.
|
||||||
.s1
|
.s1
|
||||||
If you accept a treaty,
|
|
||||||
it goes into effect immediately but the time period of the treaty
|
|
||||||
is calculated based on the offer date
|
|
||||||
rather than the acceptance date.
|
|
||||||
.s1
|
|
||||||
Loan offers are withdrawn if not accepted within a number
|
Loan offers are withdrawn if not accepted within a number
|
||||||
of days equal to the proposed loan's duration.
|
of days equal to the proposed loan's duration.
|
||||||
.s1
|
.s1
|
||||||
Treaty offers expire at the time the proposed treaty would expire.
|
|
||||||
.s1
|
|
||||||
Warning: When the terms of a loan are printed out,
|
Warning: When the terms of a loan are printed out,
|
||||||
take note of the due date;
|
take note of the due date;
|
||||||
if you do not pay by the due date the interest will double
|
if you do not pay by the due date the interest will double
|
||||||
and you will be subject to \*Qcollection\*U,
|
and you will be subject to \*Qcollection\*U,
|
||||||
(see \*Qinfo collect\*U).
|
(see \*Qinfo collect\*U).
|
||||||
.s1
|
.s1
|
||||||
.SA "collect, ledger, offer, treaty, Loans"
|
.SA "collect, ledger, offer, Loans"
|
||||||
|
|
|
@ -28,7 +28,6 @@ and what news to see with the ?action selector. Actions are:
|
||||||
2) Unsuccessful attack
|
2) Unsuccessful attack
|
||||||
3) Spy shot
|
3) Spy shot
|
||||||
4) Telegram sent
|
4) Telegram sent
|
||||||
5) Treaty signing
|
|
||||||
6) Loan made
|
6) Loan made
|
||||||
7) Loan repaid
|
7) Loan repaid
|
||||||
8) Goods sold
|
8) Goods sold
|
||||||
|
@ -44,8 +43,6 @@ and what news to see with the ?action selector. Actions are:
|
||||||
18) Successful boarding actions
|
18) Successful boarding actions
|
||||||
19) Unsuccessful boarding actions
|
19) Unsuccessful boarding actions
|
||||||
21) Collecting on loans
|
21) Collecting on loans
|
||||||
22) Considering treaty violation
|
|
||||||
23) Actual treaty violation
|
|
||||||
25) Ships hitting mines
|
25) Ships hitting mines
|
||||||
26) Alliance declaration
|
26) Alliance declaration
|
||||||
28) War declarations
|
28) War declarations
|
||||||
|
|
50
info/offer.t
50
info/offer.t
|
@ -1,14 +1,10 @@
|
||||||
.TH Command OFFER
|
.TH Command OFFER
|
||||||
.NA offer "Offer a loan or treaty to another country"
|
.NA offer "Offer a loan to another country"
|
||||||
.LV Expert
|
.LV Expert
|
||||||
.SY "offer loan <CNUM/CNAME> <AMOUNT> <DURATION> <RATE>"
|
.SY "offer loan <CNUM/CNAME> <AMOUNT> <DURATION> <RATE>"
|
||||||
.SY "offer treaty <CNUM/CNAME>"
|
The offer command is used to offer a loan
|
||||||
The offer command is used to offer either a loan or a treaty
|
|
||||||
to another country.
|
to another country.
|
||||||
.s1
|
.s1
|
||||||
In the case of a loan:
|
|
||||||
.in +4
|
|
||||||
.s1
|
|
||||||
<CNUM/CNAME> is the number or name of the country to whom
|
<CNUM/CNAME> is the number or name of the country to whom
|
||||||
you are offering the loan,
|
you are offering the loan,
|
||||||
.s1
|
.s1
|
||||||
|
@ -31,44 +27,4 @@ and you will be notified that the loan duration has started.
|
||||||
Note that the dependence of rate on the duration makes a 30 day loan
|
Note that the dependence of rate on the duration makes a 30 day loan
|
||||||
at 10% a worse deal than a 60 day loan at 15%.
|
at 10% a worse deal than a 60 day loan at 15%.
|
||||||
.s1
|
.s1
|
||||||
.in -4
|
.SA "collect, consider, ledger, repay, Loans"
|
||||||
In the case of a treaty:
|
|
||||||
.s1
|
|
||||||
.in +4
|
|
||||||
<CNUM/CNAME> is the name or number of the country to whom
|
|
||||||
you wish to offer the treaty.
|
|
||||||
.s1
|
|
||||||
You will be asked to set both the conditions for yourself
|
|
||||||
and for the other country.
|
|
||||||
.s1
|
|
||||||
The conditions from which you may choose are:
|
|
||||||
.s1
|
|
||||||
.NF
|
|
||||||
Condition Command(s) affected
|
|
||||||
no attacks on land units lboard
|
|
||||||
no attacks on ships board
|
|
||||||
no sector attacks assault, attack, paradrop
|
|
||||||
no shelling ships fire
|
|
||||||
no depth-charging subs fire
|
|
||||||
no shelling land fire
|
|
||||||
no enlistments enlist
|
|
||||||
no building build
|
|
||||||
.FI
|
|
||||||
.s1
|
|
||||||
Note that the first six terms apply to interactions
|
|
||||||
between the two parties to the treaty while the last two apply
|
|
||||||
to ANY actions of the specified type.
|
|
||||||
.s1
|
|
||||||
Once you have offered the treaty,
|
|
||||||
a telegram will be sent to the other country indicating the offer.
|
|
||||||
If the other country accepts the treaty,
|
|
||||||
(using the \*Qconsider\*U command),
|
|
||||||
you will be notified that it has gone into effect.
|
|
||||||
.s1
|
|
||||||
Once signed, the treaty is not binding!
|
|
||||||
However, any violation of the treaty will be pointed out
|
|
||||||
to the violator in time for him/her to reconsider the action and will
|
|
||||||
find its way into the news.
|
|
||||||
.in -4
|
|
||||||
.s1
|
|
||||||
.SA "collect, consider, ledger, repay, treaty, Loans"
|
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
.LV Basic
|
.LV Basic
|
||||||
.SY "power [new|update] [<NUM>|country <NATS>]"
|
.SY "power [new|update] [<NUM>|country <NATS>]"
|
||||||
The power report provides one view of national strengths.
|
The power report provides one view of national strengths.
|
||||||
It can be particularly helpful in planning defense strategies
|
It can be particularly helpful in planning defense strategies.
|
||||||
and treaty voting.
|
|
||||||
.s1
|
.s1
|
||||||
Normally, the last saved power report is shown.
|
Normally, the last saved power report is shown.
|
||||||
The optional arguments \*Qnew\*U and \*Qupdate\*U request a new power
|
The optional arguments \*Qnew\*U and \*Qupdate\*U request a new power
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
.TH Command REJECT
|
.TH Command REJECT
|
||||||
.NA reject "Stop/start listening to other countries"
|
.NA reject "Stop/start listening to other countries"
|
||||||
.LV Expert
|
.LV Expert
|
||||||
.SY "reject <reject|accept> <announcements|mail|treaties|loans> <NAT>"
|
.SY "reject <reject|accept> <announcements|mail|loans> <NAT>"
|
||||||
The reject command allows you to either accept or reject announcements,
|
The reject command allows you to either accept or reject announcements,
|
||||||
mail, treaties, or loans from a country.
|
mail, or loans from a country.
|
||||||
.s1
|
.s1
|
||||||
.EX "reject"
|
.EX "reject"
|
||||||
.nf
|
.nf
|
||||||
reject or accept? reject
|
reject or accept? reject
|
||||||
mail, treaties, loans, or announcements? anno
|
mail, loans, or announcements? anno
|
||||||
nat(s)? 0
|
nat(s)? 0
|
||||||
Rejecting annos from The_Scum
|
Rejecting annos from The_Scum
|
||||||
.fi
|
.fi
|
||||||
.EX "reject"
|
.EX "reject"
|
||||||
.nf
|
.nf
|
||||||
reject or accept? accept
|
reject or accept? accept
|
||||||
mail, treaties, loans, or announcements? anno
|
mail, loans, or announcements? anno
|
||||||
nat(s)? 0
|
nat(s)? 0
|
||||||
Accepting annos from The_Scum
|
Accepting annos from The_Scum
|
||||||
.fi
|
.fi
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
.NA telegram "Send \*Qdiplomatic\*U communique to another country"
|
.NA telegram "Send \*Qdiplomatic\*U communique to another country"
|
||||||
.LV Basic
|
.LV Basic
|
||||||
.SY "telegram <CNUM/CNAME>..."
|
.SY "telegram <CNUM/CNAME>..."
|
||||||
The telegram command allows non-treaty communication
|
The telegram command allows communication
|
||||||
to take place between representatives. Currently you
|
to take place between representatives. Currently you
|
||||||
are given only 1024 characters per telegram.
|
are given only 1024 characters per telegram.
|
||||||
.s1
|
.s1
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
.TH Command TREATY
|
|
||||||
.NA treaty "Listing of all current and pending treaties"
|
|
||||||
.LV Expert
|
|
||||||
.SY "treaty <TREATIES>"
|
|
||||||
The treaty command will report on all outstanding treaties and all
|
|
||||||
pending treaties. The conditions and durations are displayed.
|
|
||||||
.s1
|
|
||||||
A typical treaty report might be:
|
|
||||||
.s1
|
|
||||||
.NF
|
|
||||||
*** Empire Treaty #7 ***
|
|
||||||
(proposed)
|
|
||||||
between Curmudgeon and Urp expires Mon May 4 00:42:04 1981
|
|
||||||
Curmudgeon terms Urp terms
|
|
||||||
no attacks on ships no attacks on ships
|
|
||||||
no shelling ships
|
|
||||||
no sector attacks no sector attacks
|
|
||||||
no shelling land
|
|
||||||
no enlistments
|
|
||||||
no new land units no new land units
|
|
||||||
|
|
||||||
*** Empire Treaty #2 ***
|
|
||||||
between Curmudgeon and East Eden expires Mon May 4 00:42:59 1981
|
|
||||||
Curmudgeon terms East Eden terms
|
|
||||||
no attacks on ships no attacks on ships
|
|
||||||
no shelling ships no shelling ships
|
|
||||||
no sector attacks no sector attacks
|
|
||||||
no shelling land no shelling land
|
|
||||||
no new land units no new land units
|
|
||||||
.FI
|
|
||||||
.s1
|
|
||||||
.SA "consider, offer, Diplomacy"
|
|
|
@ -78,7 +78,7 @@ Visitors are disconnected after 5 minutes of idle time.
|
||||||
|
|
||||||
Options enabled in this game:
|
Options enabled in this game:
|
||||||
ALL_BLEED, BLITZ, EASY_BRIDGES, FALLOUT, GODNEWS, INTERDICT_ATT,
|
ALL_BLEED, BLITZ, EASY_BRIDGES, FALLOUT, GODNEWS, INTERDICT_ATT,
|
||||||
NOFOOD, NOMOBCOST, NO_PLAGUE, RAILWAYS, SAIL, TREATIES
|
NOFOOD, NOMOBCOST, NO_PLAGUE, RAILWAYS, SAIL
|
||||||
|
|
||||||
Options disabled in this game:
|
Options disabled in this game:
|
||||||
AUTO_POWER, BRIDGETOWERS, GO_RENEW, GUINEA_PIGS, HIDDEN, LOANS,
|
AUTO_POWER, BRIDGETOWERS, GO_RENEW, GUINEA_PIGS, HIDDEN, LOANS,
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
*
|
*
|
||||||
* ---
|
* ---
|
||||||
*
|
*
|
||||||
* acce.c: Report rejection status of telegrams/treaties/annos/loans
|
* acce.c: Report rejection status of telegrams/annos/loans
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
*
|
*
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* report rejection status of telegrams and treaties.
|
* report rejection status
|
||||||
* Optional argument reports staus from the
|
* Optional argument reports staus from the
|
||||||
* viewpoint of another country
|
* viewpoint of another country
|
||||||
*/
|
*/
|
||||||
|
@ -44,22 +44,14 @@ acce(void)
|
||||||
{
|
{
|
||||||
static char *rejects[] = {
|
static char *rejects[] = {
|
||||||
/* must follow reject flags defined in nat.h */
|
/* must follow reject flags defined in nat.h */
|
||||||
" YES YES YES YES",
|
" YES YES YES",
|
||||||
" NO YES YES YES",
|
" NO YES YES",
|
||||||
" YES NO YES YES",
|
" YES NO YES",
|
||||||
" NO NO YES YES",
|
" NO NO YES",
|
||||||
" YES YES NO YES",
|
" YES YES NO ",
|
||||||
" NO YES NO YES",
|
" NO YES NO ",
|
||||||
" YES NO NO YES",
|
" YES NO NO ",
|
||||||
" NO NO NO YES",
|
" NO NO NO ",
|
||||||
" YES YES YES NO ",
|
|
||||||
" NO YES YES NO ",
|
|
||||||
" YES NO YES NO ",
|
|
||||||
" NO NO YES NO ",
|
|
||||||
" YES YES NO NO ",
|
|
||||||
" NO YES NO NO ",
|
|
||||||
" YES NO NO NO ",
|
|
||||||
" NO NO NO NO "
|
|
||||||
};
|
};
|
||||||
struct natstr *natp;
|
struct natstr *natp;
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
@ -75,9 +67,9 @@ acce(void)
|
||||||
as = natp->nat_cnum;
|
as = natp->nat_cnum;
|
||||||
pr("\t%s Acceptance Status Report\t", cname(as));
|
pr("\t%s Acceptance Status Report\t", cname(as));
|
||||||
prdate();
|
prdate();
|
||||||
pr("\n Acceptance status %5s theirs\n",
|
pr("\n Acceptance status %s theirs\n",
|
||||||
player->cnum == as ? "yours" : " his");
|
player->cnum == as ? "yours" : " his ");
|
||||||
pr(" tel trty anno loan tel trty anno loan\n");
|
pr(" tel anno loan tel anno loan\n");
|
||||||
for (cn = 0; cn < MAXNOC; cn++) {
|
for (cn = 0; cn < MAXNOC; cn++) {
|
||||||
if (cn == as)
|
if (cn == as)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -89,10 +89,8 @@ assa(void)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show what we're assaulting, and check treaties */
|
/* Show what we're assaulting */
|
||||||
|
att_show(def);
|
||||||
if (att_show(def))
|
|
||||||
return RET_FAIL;
|
|
||||||
|
|
||||||
/* Ask about offensive support */
|
/* Ask about offensive support */
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,8 @@ atta(void)
|
||||||
if (att_abort(A_ATTACK, NULL, def))
|
if (att_abort(A_ATTACK, NULL, def))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
|
||||||
/* Show what we're attacking, and check treaties */
|
/* Show what we're attacking */
|
||||||
|
att_show(def);
|
||||||
if (att_show(def))
|
|
||||||
return RET_FAIL;
|
|
||||||
|
|
||||||
/* Ask about offensive support */
|
/* Ask about offensive support */
|
||||||
|
|
||||||
|
|
|
@ -122,10 +122,8 @@ boar(void)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show what we're boarding, and check treaties */
|
/* Show what we're boarding */
|
||||||
|
att_show(def);
|
||||||
if (att_show(def))
|
|
||||||
return RET_FAIL;
|
|
||||||
|
|
||||||
/* Ask the player what he wants to board with */
|
/* Ask the player what he wants to board with */
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
#include "plague.h"
|
#include "plague.h"
|
||||||
#include "plane.h"
|
#include "plane.h"
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
#include "treaty.h"
|
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
|
|
||||||
static int build_ship(struct sctstr *sp, int type, int tlev);
|
static int build_ship(struct sctstr *sp, int type, int tlev);
|
||||||
|
@ -240,10 +239,6 @@ build_ship(struct sctstr *sp, int type, int tlev)
|
||||||
cost = mp->m_cost * SHIP_MINEFF / 100.0;
|
cost = mp->m_cost * SHIP_MINEFF / 100.0;
|
||||||
if (!build_can_afford(cost, mp->m_name))
|
if (!build_can_afford(cost, mp->m_name))
|
||||||
return 0;
|
return 0;
|
||||||
if (!trechk(player->cnum, 0, NEWSHP))
|
|
||||||
return 0;
|
|
||||||
if (!check_sect_ok(sp))
|
|
||||||
return 0;
|
|
||||||
sp->sct_avail -= avail;
|
sp->sct_avail -= avail;
|
||||||
player->dolcost += cost;
|
player->dolcost += cost;
|
||||||
ef_blank(EF_SHIP, pick_unused_unit_uid(EF_SHIP), &ship);
|
ef_blank(EF_SHIP, pick_unused_unit_uid(EF_SHIP), &ship);
|
||||||
|
@ -331,10 +326,6 @@ build_land(struct sctstr *sp, int type, int tlev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!trechk(player->cnum, 0, NEWLND))
|
|
||||||
return 0;
|
|
||||||
if (!check_sect_ok(sp))
|
|
||||||
return 0;
|
|
||||||
avail = (LND_BLD_WORK(lp->l_lcm, lp->l_hcm) * LAND_MINEFF + 99) / 100;
|
avail = (LND_BLD_WORK(lp->l_lcm, lp->l_hcm) * LAND_MINEFF + 99) / 100;
|
||||||
if (sp->sct_avail < avail) {
|
if (sp->sct_avail < avail) {
|
||||||
pr("Not enough available work in %s to build a %s\n",
|
pr("Not enough available work in %s to build a %s\n",
|
||||||
|
@ -421,10 +412,6 @@ build_nuke(struct sctstr *sp, int type, int tlev)
|
||||||
pr(" (%d available work required)\n", avail);
|
pr(" (%d available work required)\n", avail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!trechk(player->cnum, 0, NEWNUK))
|
|
||||||
return 0;
|
|
||||||
if (!check_sect_ok(sp))
|
|
||||||
return 0;
|
|
||||||
sp->sct_avail -= avail;
|
sp->sct_avail -= avail;
|
||||||
player->dolcost += np->n_cost;
|
player->dolcost += np->n_cost;
|
||||||
ef_blank(EF_NUKE, pick_unused_unit_uid(EF_NUKE), &nuke);
|
ef_blank(EF_NUKE, pick_unused_unit_uid(EF_NUKE), &nuke);
|
||||||
|
@ -494,10 +481,6 @@ build_plane(struct sctstr *sp, int type, int tlev)
|
||||||
xyas(sp->sct_x, sp->sct_y, player->cnum));
|
xyas(sp->sct_x, sp->sct_y, player->cnum));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!trechk(player->cnum, 0, NEWPLN))
|
|
||||||
return 0;
|
|
||||||
if (!check_sect_ok(sp))
|
|
||||||
return 0;
|
|
||||||
sp->sct_avail -= avail;
|
sp->sct_avail -= avail;
|
||||||
player->dolcost += cost;
|
player->dolcost += cost;
|
||||||
ef_blank(EF_PLANE, pick_unused_unit_uid(EF_PLANE), &plane);
|
ef_blank(EF_PLANE, pick_unused_unit_uid(EF_PLANE), &plane);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
*
|
*
|
||||||
* ---
|
* ---
|
||||||
*
|
*
|
||||||
* cons.c: Consider a loan or treaty
|
* cons.c: Consider a loan
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Markus Armbruster, 2004-2014
|
* Markus Armbruster, 2004-2014
|
||||||
|
@ -36,23 +36,18 @@
|
||||||
#include "loan.h"
|
#include "loan.h"
|
||||||
#include "news.h"
|
#include "news.h"
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
#include "treaty.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Things common to a loan or treaty.
|
|
||||||
*/
|
|
||||||
struct ltcomstr {
|
struct ltcomstr {
|
||||||
int type; /* EF_LOAN or EF_TREATY */
|
int type; /* currently always EF_LOAN */
|
||||||
int num; /* number */
|
int num; /* number */
|
||||||
char *name; /* "loan" or "treaty" */
|
char *name; /* "loan" */
|
||||||
char *Name; /* "Loan" or "Treaty" */
|
char *Name; /* "Loan" */
|
||||||
natid proposer; /* country offering */
|
natid proposer; /* country offering */
|
||||||
natid proposee; /* country offered to */
|
natid proposee; /* country offered to */
|
||||||
natid mailee; /* who gets mail about it */
|
natid mailee; /* who gets mail about it */
|
||||||
char op; /* 'a', 'd', or 'p' */
|
char op; /* 'a', 'd', or 'p' */
|
||||||
union {
|
union {
|
||||||
struct lonstr l; /* the loan */
|
struct lonstr l; /* the loan */
|
||||||
struct trtstr t; /* the treaty */
|
|
||||||
} u;
|
} u;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,8 +56,6 @@ static int cons_display(struct ltcomstr *ltcp);
|
||||||
static int cons_accept(struct ltcomstr *ltcp);
|
static int cons_accept(struct ltcomstr *ltcp);
|
||||||
static int cons_decline(struct ltcomstr *ltcp);
|
static int cons_decline(struct ltcomstr *ltcp);
|
||||||
static int cons_postpone(struct ltcomstr *ltcp);
|
static int cons_postpone(struct ltcomstr *ltcp);
|
||||||
static int treaty_accept(struct ltcomstr *ltcp);
|
|
||||||
static int treaty_decline(struct ltcomstr *ltcp);
|
|
||||||
static int loan_accept(struct ltcomstr *ltcp);
|
static int loan_accept(struct ltcomstr *ltcp);
|
||||||
static int loan_decline(struct ltcomstr *ltcp);
|
static int loan_decline(struct ltcomstr *ltcp);
|
||||||
static void accpt(struct ltcomstr *ltcp);
|
static void accpt(struct ltcomstr *ltcp);
|
||||||
|
@ -95,32 +88,22 @@ cons(void)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Choose whether we want to accept, decline, or postpone a
|
* Choose whether we want to accept, decline, or postpone a
|
||||||
* loan or treaty. Put all the goodies in ltcp, and return
|
* loan. Put all the goodies in ltcp, and return
|
||||||
* RET_OK if all goes well, and anything else on error.
|
* RET_OK if all goes well, and anything else on error.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
cons_choose(struct ltcomstr *ltcp)
|
cons_choose(struct ltcomstr *ltcp)
|
||||||
{
|
{
|
||||||
static int lon_or_trt[] = { EF_LOAN, EF_TREATY, EF_BAD };
|
static int lon_or_trt[] = { EF_LOAN, EF_BAD };
|
||||||
char *p;
|
char *p;
|
||||||
struct lonstr *lp;
|
struct lonstr *lp;
|
||||||
struct trtstr *tp;
|
|
||||||
char prompt[128];
|
char prompt[128];
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
memset(ltcp, 0, sizeof(*ltcp));
|
memset(ltcp, 0, sizeof(*ltcp));
|
||||||
if (!getstarg(player->argp[1], "loan or treaty? ", buf))
|
p = player->argp[1] ? player->argp[1] : "loan";
|
||||||
return RET_SYN;
|
ltcp->type = ef_byname_from(p, lon_or_trt);
|
||||||
ltcp->type = ef_byname_from(buf, lon_or_trt);
|
|
||||||
switch (ltcp->type) {
|
switch (ltcp->type) {
|
||||||
case EF_TREATY:
|
|
||||||
if (!opt_TREATIES) {
|
|
||||||
pr("Treaties are not enabled.\n");
|
|
||||||
return RET_FAIL;
|
|
||||||
}
|
|
||||||
ltcp->name = "treaty";
|
|
||||||
ltcp->Name = "Treaty";
|
|
||||||
break;
|
|
||||||
case EF_LOAN:
|
case EF_LOAN:
|
||||||
if (!opt_LOANS) {
|
if (!opt_LOANS) {
|
||||||
pr("Loans are not enabled.\n");
|
pr("Loans are not enabled.\n");
|
||||||
|
@ -130,7 +113,7 @@ cons_choose(struct ltcomstr *ltcp)
|
||||||
ltcp->Name = "Loan";
|
ltcp->Name = "Loan";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pr("You must specify \"loan\" or \"treaty\".\n");
|
pr("You must specify \"loan\".\n");
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
sprintf(prompt, "%s number? ", ltcp->Name);
|
sprintf(prompt, "%s number? ", ltcp->Name);
|
||||||
|
@ -150,15 +133,6 @@ cons_choose(struct ltcomstr *ltcp)
|
||||||
ltcp->proposer = lp->l_loner;
|
ltcp->proposer = lp->l_loner;
|
||||||
ltcp->proposee = lp->l_lonee;
|
ltcp->proposee = lp->l_lonee;
|
||||||
break;
|
break;
|
||||||
case EF_TREATY:
|
|
||||||
tp = <cp->u.t;
|
|
||||||
if (tp->trt_status == TS_SIGNED) {
|
|
||||||
pr("That treaty has already been accepted!\n");
|
|
||||||
return RET_FAIL;
|
|
||||||
}
|
|
||||||
ltcp->proposer = tp->trt_cna;
|
|
||||||
ltcp->proposee = tp->trt_cnb;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ltcp->mailee = (ltcp->proposer == player->cnum)
|
ltcp->mailee = (ltcp->proposer == player->cnum)
|
||||||
? ltcp->proposee : ltcp->proposer;
|
? ltcp->proposee : ltcp->proposer;
|
||||||
|
@ -175,8 +149,6 @@ cons_display(struct ltcomstr *ltcp)
|
||||||
switch (ltcp->type) {
|
switch (ltcp->type) {
|
||||||
case EF_LOAN:
|
case EF_LOAN:
|
||||||
return disloan(ltcp->num, <cp->u.l);
|
return disloan(ltcp->num, <cp->u.l);
|
||||||
case EF_TREATY:
|
|
||||||
return distrea(ltcp->num, <cp->u.t);
|
|
||||||
default:
|
default:
|
||||||
CANT_REACH();
|
CANT_REACH();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -189,8 +161,6 @@ cons_accept(struct ltcomstr *ltcp)
|
||||||
switch (ltcp->type) {
|
switch (ltcp->type) {
|
||||||
case EF_LOAN:
|
case EF_LOAN:
|
||||||
return loan_accept(ltcp);
|
return loan_accept(ltcp);
|
||||||
case EF_TREATY:
|
|
||||||
return treaty_accept(ltcp);
|
|
||||||
default:
|
default:
|
||||||
CANT_REACH();
|
CANT_REACH();
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
@ -203,17 +173,12 @@ cons_decline(struct ltcomstr *ltcp)
|
||||||
switch (ltcp->type) {
|
switch (ltcp->type) {
|
||||||
case EF_LOAN:
|
case EF_LOAN:
|
||||||
return loan_decline(ltcp);
|
return loan_decline(ltcp);
|
||||||
case EF_TREATY:
|
|
||||||
return treaty_decline(ltcp);
|
|
||||||
default:
|
default:
|
||||||
CANT_REACH();
|
CANT_REACH();
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Postpone a treaty; always succeeds.
|
|
||||||
*/
|
|
||||||
static int
|
static int
|
||||||
cons_postpone(struct ltcomstr *ltcp)
|
cons_postpone(struct ltcomstr *ltcp)
|
||||||
{
|
{
|
||||||
|
@ -318,74 +283,8 @@ loan_decline(struct ltcomstr *ltcp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Accept a treaty. Return RET_OK on success, anything else on error.
|
* Somebody tried to accept a loan that was retracted,
|
||||||
*/
|
* or to decline a loan they already signed.
|
||||||
static int
|
|
||||||
treaty_accept(struct ltcomstr *ltcp)
|
|
||||||
{
|
|
||||||
struct trtstr *tp;
|
|
||||||
|
|
||||||
tp = <cp->u.t;
|
|
||||||
if (ltcp->proposee != player->cnum) {
|
|
||||||
pr("%s %d is still pending.\n", ltcp->Name, ltcp->num);
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
if (!gettre(ltcp->num, tp)) {
|
|
||||||
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);
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
if (tp->trt_status == TS_SIGNED) { /* somehow got accepted */
|
|
||||||
prev_signed(ltcp);
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
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_FAIL;
|
|
||||||
}
|
|
||||||
accpt(ltcp);
|
|
||||||
pr("Treaty in effect until %s", ctime(&tp->trt_exp));
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Decline a treaty. Return RET_OK on success, anything else on error.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
treaty_decline(struct ltcomstr *ltcp)
|
|
||||||
{
|
|
||||||
struct trtstr *tp;
|
|
||||||
|
|
||||||
tp = <cp->u.t;
|
|
||||||
if (!gettre(ltcp->num, tp)) {
|
|
||||||
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) {
|
|
||||||
late(ltcp);
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
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_FAIL;
|
|
||||||
}
|
|
||||||
decline(ltcp);
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Somebody tried to accept a loan/treaty that was retracted,
|
|
||||||
* or to decline a loan/treaty they already signed.
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
late(struct ltcomstr *ltcp)
|
late(struct ltcomstr *ltcp)
|
||||||
|
@ -396,7 +295,7 @@ late(struct ltcomstr *ltcp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loan or treaty was previously signed.
|
* Loan was previously signed.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
prev_signed(struct ltcomstr *ltcp)
|
prev_signed(struct ltcomstr *ltcp)
|
||||||
|
@ -405,7 +304,7 @@ prev_signed(struct ltcomstr *ltcp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Post-processing after successful declination of loan or treaty.
|
* Post-processing after successful declination of loan.
|
||||||
* Notify the folks involved.
|
* Notify the folks involved.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
@ -424,7 +323,7 @@ decline(struct ltcomstr *ltcp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Post-processing after successful acceptance of loan or treaty.
|
* Post-processing after successful acceptance of loan.
|
||||||
* Notify the press, and the folks involved.
|
* Notify the press, and the folks involved.
|
||||||
* (Weird spelling is to avoid accept(2)).
|
* (Weird spelling is to avoid accept(2)).
|
||||||
*/
|
*/
|
||||||
|
@ -435,9 +334,6 @@ accpt(struct ltcomstr *ltcp)
|
||||||
case EF_LOAN:
|
case EF_LOAN:
|
||||||
nreport(ltcp->proposer, N_MAKE_LOAN, player->cnum, 1);
|
nreport(ltcp->proposer, N_MAKE_LOAN, player->cnum, 1);
|
||||||
break;
|
break;
|
||||||
case EF_TREATY:
|
|
||||||
nreport(player->cnum, N_SIGN_TRE, ltcp->mailee, 1);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
CANT_REACH();
|
CANT_REACH();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
|
|
||||||
#include "chance.h"
|
#include "chance.h"
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "treaty.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
enli(void)
|
enli(void)
|
||||||
|
@ -55,8 +54,6 @@ enli(void)
|
||||||
|
|
||||||
if (!snxtsct(&nstr, player->argp[1]))
|
if (!snxtsct(&nstr, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!trechk(player->cnum, 0, TRTENL))
|
|
||||||
return RET_FAIL;
|
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
newmil = 500;
|
newmil = 500;
|
||||||
sprintf(prompt, "Number to enlist (max %d) : ", newmil);
|
sprintf(prompt, "Number to enlist (max %d) : ", newmil);
|
||||||
|
|
|
@ -94,9 +94,7 @@ lboa(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show what we're boarding */
|
/* Show what we're boarding */
|
||||||
|
att_show(def);
|
||||||
if (att_show(def))
|
|
||||||
return RET_FAIL;
|
|
||||||
|
|
||||||
/* Ask the player what he wants to board with */
|
/* Ask the player what he wants to board with */
|
||||||
|
|
||||||
|
|
|
@ -367,22 +367,6 @@ multifire(void)
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (target) {
|
|
||||||
case targ_ship:
|
|
||||||
if (!trechk(player->cnum, vict, SEAFIR))
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case targ_sub:
|
|
||||||
if (!trechk(player->cnum, vict, SUBFIR))
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case targ_land:
|
|
||||||
if (!trechk(player->cnum, vict, LANFIR))
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
nfiring++;
|
nfiring++;
|
||||||
switch (target) {
|
switch (target) {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
*
|
*
|
||||||
* ---
|
* ---
|
||||||
*
|
*
|
||||||
* offe.c: Offer a loan or treaty
|
* offe.c: Offer a loan
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Pat Loney, 1992
|
* Pat Loney, 1992
|
||||||
|
@ -36,21 +36,15 @@
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "loan.h"
|
#include "loan.h"
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
#include "treaty.h"
|
|
||||||
|
|
||||||
static int do_treaty(void);
|
|
||||||
static int do_loan(void);
|
static int do_loan(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
offe(void)
|
offe(void)
|
||||||
{
|
{
|
||||||
char *cp;
|
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) {
|
switch (*cp) {
|
||||||
case 'l':
|
case 'l':
|
||||||
if (!opt_LOANS) {
|
if (!opt_LOANS) {
|
||||||
|
@ -58,100 +52,12 @@ offe(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
return do_loan();
|
return do_loan();
|
||||||
case 't':
|
|
||||||
if (!opt_TREATIES) {
|
|
||||||
pr("Treaties are not enabled.\n");
|
|
||||||
return RET_FAIL;
|
|
||||||
}
|
|
||||||
return do_treaty();
|
|
||||||
default:
|
default:
|
||||||
pr("You must specify \"loan\" as there are no treaties.\n");
|
pr("You must specify \"loan\".\n");
|
||||||
return RET_SYN;
|
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
|
static int
|
||||||
do_loan(void)
|
do_loan(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,10 +130,8 @@ paradrop(struct emp_qelem *list, coord x, coord y)
|
||||||
if (att_abort(A_PARA, NULL, def))
|
if (att_abort(A_PARA, NULL, def))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
|
||||||
/* Show what we're air-assaulting, and check treaties */
|
/* Show what we're air-assaulting */
|
||||||
|
att_show(def);
|
||||||
if (att_show(def))
|
|
||||||
return RET_FAIL;
|
|
||||||
|
|
||||||
/* set what we're air-assaulting with */
|
/* set what we're air-assaulting with */
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
*
|
*
|
||||||
* ---
|
* ---
|
||||||
*
|
*
|
||||||
* reje.c: Refuse telegrams/annos/treaties/loans from countries
|
* reje.c: Refuse telegrams/annos/loans from countries
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
*
|
*
|
||||||
|
@ -58,7 +58,7 @@ reje(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
p = getstarg(player->argp[2],
|
p = getstarg(player->argp[2],
|
||||||
"mail, treaties, loans, or announcements? ", buf);
|
"mail, loans, or announcements? ", buf);
|
||||||
if (!p)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
|
@ -71,9 +71,6 @@ reje(void)
|
||||||
case 'm':
|
case 'm':
|
||||||
rel = REJ_TELE;
|
rel = REJ_TELE;
|
||||||
break;
|
break;
|
||||||
case 't':
|
|
||||||
rel = REJ_TREA;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
pr("That's not one of the choices!\n");
|
pr("That's not one of the choices!\n");
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
@ -102,10 +99,6 @@ reje(void)
|
||||||
pr("%s teles from %s\n",
|
pr("%s teles from %s\n",
|
||||||
(do_undo == 1 ? "Rejecting" : "Accepting"), nat.nat_cnam);
|
(do_undo == 1 ? "Rejecting" : "Accepting"), nat.nat_cnam);
|
||||||
break;
|
break;
|
||||||
case REJ_TREA:
|
|
||||||
pr("%s treaties from %s\n",
|
|
||||||
(do_undo == 1 ? "Rejecting" : "Accepting"), nat.nat_cnam);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
setrej(player->cnum, (natid)ni.cur, do_undo, rel);
|
setrej(player->cnum, (natid)ni.cur, do_undo, rel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* Empire - A multi-player, client/server Internet based war game.
|
|
||||||
* Copyright (C) 1986-2014, Dave Pare, Jeff Bailey, Thomas Ruschak,
|
|
||||||
* Ken Stevens, Steve McClure, Markus Armbruster
|
|
||||||
*
|
|
||||||
* Empire is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* trea.c: Look at current treaties.
|
|
||||||
*
|
|
||||||
* Known contributors to this file:
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include "commands.h"
|
|
||||||
#include "treaty.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
trea(void)
|
|
||||||
{
|
|
||||||
struct trtstr treaty;
|
|
||||||
struct nstr_item nstr;
|
|
||||||
int ntreaty;
|
|
||||||
|
|
||||||
if (!snxtitem(&nstr, EF_TREATY, player->argp[1], NULL))
|
|
||||||
return RET_SYN;
|
|
||||||
pr("\t... %s Treaty Report ...\n", cname(player->cnum));
|
|
||||||
ntreaty = 0;
|
|
||||||
while (nxtitem(&nstr, &treaty)) {
|
|
||||||
if (distrea(nstr.cur, &treaty) > 0)
|
|
||||||
ntreaty++;
|
|
||||||
}
|
|
||||||
if (!ntreaty)
|
|
||||||
pr("No treaties found.\n");
|
|
||||||
else
|
|
||||||
pr("%d treat%s\n", ntreaty, iesplur(ntreaty));
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
|
@ -46,7 +46,6 @@ static int
|
||||||
xdvisible(int type, void *p)
|
xdvisible(int type, void *p)
|
||||||
{
|
{
|
||||||
struct empobj *gp = p;
|
struct empobj *gp = p;
|
||||||
struct trtstr *tp = p;
|
|
||||||
struct lonstr *lp = p;
|
struct lonstr *lp = p;
|
||||||
struct natstr *natp;
|
struct natstr *natp;
|
||||||
int tlev;
|
int tlev;
|
||||||
|
@ -67,10 +66,6 @@ xdvisible(int type, void *p)
|
||||||
return gp->own == player->cnum;
|
return gp->own == player->cnum;
|
||||||
case EF_NEWS:
|
case EF_NEWS:
|
||||||
return !opt_HIDDEN || player->god; /* FIXME */
|
return !opt_HIDDEN || player->god; /* FIXME */
|
||||||
case EF_TREATY:
|
|
||||||
return tp->trt_cna == player->cnum
|
|
||||||
|| tp->trt_cnb == player->cnum
|
|
||||||
|| player->god;
|
|
||||||
case EF_LOAN:
|
case EF_LOAN:
|
||||||
if (lp->l_status == LS_SIGNED)
|
if (lp->l_status == LS_SIGNED)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -93,8 +93,6 @@ empobj_in_use(int type, void *p)
|
||||||
return ((struct natstr *)p)->nat_stat != STAT_UNUSED;
|
return ((struct natstr *)p)->nat_stat != STAT_UNUSED;
|
||||||
case EF_NEWS:
|
case EF_NEWS:
|
||||||
return ((struct nwsstr *)p)->nws_vrb != 0;
|
return ((struct nwsstr *)p)->nws_vrb != 0;
|
||||||
case EF_TREATY:
|
|
||||||
return ((struct trtstr *)p)->trt_status != TS_FREE;
|
|
||||||
case EF_LOAN:
|
case EF_LOAN:
|
||||||
return ((struct lonstr *)p)->l_status != LS_FREE;
|
return ((struct lonstr *)p)->l_status != LS_FREE;
|
||||||
case EF_REALM:
|
case EF_REALM:
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "trade.h"
|
#include "trade.h"
|
||||||
#include "treaty.h"
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "xy.h"
|
#include "xy.h"
|
||||||
|
|
||||||
|
@ -154,9 +153,6 @@ struct empfile empfile[] = {
|
||||||
{EF_NEWS, "news", NULL, "news", news_ca, EF_BAD,
|
{EF_NEWS, "news", NULL, "news", news_ca, EF_BAD,
|
||||||
UNMAPPED_CACHE(struct nwsstr, -1, 0),
|
UNMAPPED_CACHE(struct nwsstr, -1, 0),
|
||||||
NULL, NULL, NULL, NULL},
|
NULL, NULL, NULL, NULL},
|
||||||
{EF_TREATY, "treaty", NULL, "treaty", treaty_ca, EF_BAD,
|
|
||||||
UNMAPPED_CACHE(struct trtstr, -1, EFF_TYPED),
|
|
||||||
NULL, NULL, NULL, NULL},
|
|
||||||
{EF_TRADE, "trade", "trade lot", "trade", trade_ca, EF_BAD,
|
{EF_TRADE, "trade", "trade lot", "trade", trade_ca, EF_BAD,
|
||||||
UNMAPPED_CACHE(struct trdstr, -1, EFF_TYPED | EFF_OWNER),
|
UNMAPPED_CACHE(struct trdstr, -1, EFF_TYPED | EFF_OWNER),
|
||||||
NULL, NULL, NULL, NULL},
|
NULL, NULL, NULL, NULL},
|
||||||
|
@ -265,7 +261,6 @@ struct empfile empfile[] = {
|
||||||
SYMTAB(EF_RETREAT_FLAGS, "retreat-flags", retreat_flags),
|
SYMTAB(EF_RETREAT_FLAGS, "retreat-flags", retreat_flags),
|
||||||
SYMTAB(EF_SECTOR_NAVIGATION, "sector-navigation", sector_navigation),
|
SYMTAB(EF_SECTOR_NAVIGATION, "sector-navigation", sector_navigation),
|
||||||
SYMTAB(EF_SHIP_CHR_FLAGS, "ship-chr-flags", ship_chr_flags),
|
SYMTAB(EF_SHIP_CHR_FLAGS, "ship-chr-flags", ship_chr_flags),
|
||||||
SYMTAB(EF_TREATY_FLAGS, "treaty-flags", treaty_flags),
|
|
||||||
|
|
||||||
/* Views */
|
/* Views */
|
||||||
{EF_COUNTRY, "country", NULL, NULL, cou_ca, EF_NATION,
|
{EF_COUNTRY, "country", NULL, NULL, cou_ca, EF_NATION,
|
||||||
|
|
|
@ -432,24 +432,6 @@ struct castr nchr_ca[] = {
|
||||||
#undef CURSTR
|
#undef CURSTR
|
||||||
};
|
};
|
||||||
|
|
||||||
struct castr treaty_ca[] = {
|
|
||||||
#define CURSTR struct trtstr
|
|
||||||
{"uid", fldoff(trt_uid), NSC_INT, 0, NULL, EF_TREATY, 0},
|
|
||||||
{"timestamp", fldoff(trt_timestamp), NSC_TIME, 0, NULL,
|
|
||||||
EF_BAD, NSC_EXTRA},
|
|
||||||
{"cna", fldoff(trt_cna), NSC_NATID, 0, NULL, EF_NATION, 0},
|
|
||||||
{"cnb", fldoff(trt_cnb), NSC_NATID, 0, NULL, EF_NATION, 0},
|
|
||||||
{"status", fldoff(trt_status), NSC_CHAR, 0, NULL,
|
|
||||||
EF_AGREEMENT_STATUS, 0},
|
|
||||||
{"acond", fldoff(trt_acond), NSC_SHORT, 0, NULL,
|
|
||||||
EF_TREATY_FLAGS, NSC_BITS},
|
|
||||||
{"bcond", fldoff(trt_bcond), NSC_SHORT, 0, NULL,
|
|
||||||
EF_TREATY_FLAGS, NSC_BITS},
|
|
||||||
{"exp", fldoff(trt_exp), NSC_TIME, 0, NULL, EF_BAD, 0},
|
|
||||||
{NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
|
|
||||||
#undef CURSTR
|
|
||||||
};
|
|
||||||
|
|
||||||
struct castr loan_ca[] = {
|
struct castr loan_ca[] = {
|
||||||
#define CURSTR struct lonstr
|
#define CURSTR struct lonstr
|
||||||
{"uid", fldoff(l_uid), NSC_INT, 0, NULL, EF_LOAN, 0},
|
{"uid", fldoff(l_uid), NSC_INT, 0, NULL, EF_LOAN, 0},
|
||||||
|
|
|
@ -56,7 +56,6 @@
|
||||||
* - Planes: EF_PLANE (superseding pdump)
|
* - Planes: EF_PLANE (superseding pdump)
|
||||||
* - Ships: EF_SHIP (superseding sdump)
|
* - Ships: EF_SHIP (superseding sdump)
|
||||||
* - News: EF_NEWS
|
* - News: EF_NEWS
|
||||||
* - Treaties: EF_TREATY
|
|
||||||
* - Power: EF_POWER (TODO)
|
* - Power: EF_POWER (TODO)
|
||||||
* - Nations: EF_NATION
|
* - Nations: EF_NATION
|
||||||
* - Loans: EF_LOAN
|
* - Loans: EF_LOAN
|
||||||
|
|
|
@ -55,8 +55,7 @@ struct rptstr rpt[] = {
|
||||||
"spy captured and shot by %s" } },
|
"spy captured and shot by %s" } },
|
||||||
{ N_SENT_TEL, 1, N_TELE, { "sends a telegram to %s",
|
{ N_SENT_TEL, 1, N_TELE, { "sends a telegram to %s",
|
||||||
"telexes %s" } },
|
"telexes %s" } },
|
||||||
{ N_SIGN_TRE, 3, N_FOR, { "diplomats sign a treaty with %s",
|
{ 5, 0, 0, { no_news, no_news } },
|
||||||
"ambassador agrees to a treaty with %s" } },
|
|
||||||
{ N_MAKE_LOAN, 2, N_ECON, { "bankers make a loan to %s",
|
{ N_MAKE_LOAN, 2, N_ECON, { "bankers make a loan to %s",
|
||||||
"Ministry of Finance lends money to %s" } },
|
"Ministry of Finance lends money to %s" } },
|
||||||
{ N_REPAY_LOAN, 1, N_ECON, { "repays a loan from %s",
|
{ N_REPAY_LOAN, 1, N_ECON, { "repays a loan from %s",
|
||||||
|
@ -88,10 +87,8 @@ struct rptstr rpt[] = {
|
||||||
{ 20, 0, 0, { no_news, no_news } },
|
{ 20, 0, 0, { no_news, no_news } },
|
||||||
{ N_SEIZE_SECT, -2, N_ECON, { "seizes a sector from %s to collect on a loan",
|
{ N_SEIZE_SECT, -2, N_ECON, { "seizes a sector from %s to collect on a loan",
|
||||||
"collects one of %s's sectors in repayment of a loan" } },
|
"collects one of %s's sectors in repayment of a loan" } },
|
||||||
{ N_HONOR_TRE, -1, N_FOR, { "considers an action which would violate a treaty with %s",
|
{ 22, 0, 0, { no_news, no_news } },
|
||||||
"decides not to violate treaty with %s (yet)" } },
|
{ 23, 0, 0, { no_news, no_news } },
|
||||||
{ N_VIOL_TRE, -4, N_FOR, { "violates a treaty with %s",
|
|
||||||
"actions violate treaty with %s" } },
|
|
||||||
{ 24, 0, 0, { no_news, no_news } },
|
{ 24, 0, 0, { no_news, no_news } },
|
||||||
{ N_HIT_MINE, 0, N_SEA, { "ship hits a mine",
|
{ N_HIT_MINE, 0, N_SEA, { "ship hits a mine",
|
||||||
"ship severely damaged in mine field" } },
|
"ship severely damaged in mine field" } },
|
||||||
|
|
|
@ -59,4 +59,3 @@ int opt_RES_POP = 0;
|
||||||
int opt_SAIL = 1;
|
int opt_SAIL = 1;
|
||||||
int opt_SUPER_BARS = 0;
|
int opt_SUPER_BARS = 0;
|
||||||
int opt_TECH_POP = 0;
|
int opt_TECH_POP = 0;
|
||||||
int opt_TREATIES = 1;
|
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include "retreat.h"
|
#include "retreat.h"
|
||||||
#include "sect.h"
|
#include "sect.h"
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
#include "treaty.h"
|
|
||||||
|
|
||||||
struct symbol agreement_statuses[] = {
|
struct symbol agreement_statuses[] = {
|
||||||
{AGREE_FREE, "free"},
|
{AGREE_FREE, "free"},
|
||||||
|
@ -129,7 +128,6 @@ struct symbol nation_flags[] = {
|
||||||
|
|
||||||
struct symbol nation_rejects[] = {
|
struct symbol nation_rejects[] = {
|
||||||
{REJ_TELE, "telegrams"},
|
{REJ_TELE, "telegrams"},
|
||||||
{REJ_TREA, "treaties"},
|
|
||||||
{REJ_ANNO, "announcements"},
|
{REJ_ANNO, "announcements"},
|
||||||
{REJ_LOAN, "loans"},
|
{REJ_LOAN, "loans"},
|
||||||
{0, NULL}
|
{0, NULL}
|
||||||
|
@ -276,18 +274,3 @@ struct symbol ship_chr_flags[] = {
|
||||||
{M_ANTIMISSILE, "anti-missile"},
|
{M_ANTIMISSILE, "anti-missile"},
|
||||||
{0, NULL}
|
{0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct symbol treaty_flags[] = {
|
|
||||||
{LNDATT, "no attacks on any land units"},
|
|
||||||
{SEAATT, "no attacks on any ships"},
|
|
||||||
{SEAFIR, "no shelling any ships"},
|
|
||||||
{SUBFIR, "no depth-charging any subs"},
|
|
||||||
{LANATT, "no sector attacks"},
|
|
||||||
{LANFIR, "no shelling any land"},
|
|
||||||
{NEWSHP, "no building ships"},
|
|
||||||
{NEWNUK, "no new nuclear weapons"},
|
|
||||||
{NEWPLN, "no building planes"},
|
|
||||||
{NEWLND, "no building land units"},
|
|
||||||
{TRTENL, "no enlistment"},
|
|
||||||
{0, NULL}
|
|
||||||
};
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ struct cmndstr player_coms[] = {
|
||||||
{"coastwatch <SECTS>", 1, coas, C_MOD, NORM + CAP},
|
{"coastwatch <SECTS>", 1, coas, C_MOD, NORM + CAP},
|
||||||
{"collect <LOAN> <SECT>", 2, coll, C_MOD, NORM + MONEY + CAP},
|
{"collect <LOAN> <SECT>", 2, coll, C_MOD, NORM + MONEY + CAP},
|
||||||
{"commodity <SECTS>", 0, comm, 0, NONVIS},
|
{"commodity <SECTS>", 0, comm, 0, NONVIS},
|
||||||
{"consider <loan|treaty> <LOAN/TREATY> <acc|decl|post>",
|
{"consider <loan> <LOAN> <acc|decl|post>",
|
||||||
1, cons, C_MOD, NORM + CAP},
|
1, cons, C_MOD, NORM + CAP},
|
||||||
{"convert <SECTS> <NUM>", 2, conv, C_MOD, NORM + MONEY + CAP},
|
{"convert <SECTS> <NUM>", 2, conv, C_MOD, NORM + MONEY + CAP},
|
||||||
{"country <NATS>", 0, coun, 0, 0},
|
{"country <NATS>", 0, coun, 0, 0},
|
||||||
|
@ -173,7 +173,7 @@ struct cmndstr player_coms[] = {
|
||||||
{"newspaper [days]", 0, news, 0, 0},
|
{"newspaper [days]", 0, news, 0, 0},
|
||||||
{"nmap <SECTS|NUKE> [s|l|n|p|*|h]", 0, map, C_MOD, NORM},
|
{"nmap <SECTS|NUKE> [s|l|n|p|*|h]", 0, map, C_MOD, NORM},
|
||||||
{"nuke <NUKES>", 0, nuke, 0, NORM},
|
{"nuke <NUKES>", 0, nuke, 0, NORM},
|
||||||
{"offer <loan|treaty> <NAT> [<NUM> <DAYS> <IRATE>]",
|
{"offer <loan> <NAT> [<NUM> <DAYS> <IRATE>]",
|
||||||
1, offe, C_MOD, NORM + MONEY + CAP},
|
1, offe, C_MOD, NORM + MONEY + CAP},
|
||||||
{"order <SHIPS> <c|s|r|d|l>", 1, orde, C_MOD, NORM + CAP},
|
{"order <SHIPS> <c|s|r|d|l>", 1, orde, C_MOD, NORM + CAP},
|
||||||
{"origin <SECT|COUNTRY|~>", 1, orig, C_MOD, NORM},
|
{"origin <SECT|COUNTRY|~>", 1, orig, C_MOD, NORM},
|
||||||
|
@ -201,7 +201,7 @@ struct cmndstr player_coms[] = {
|
||||||
{"realm <number> [<SECTS>]", 0, real, C_MOD, NORM},
|
{"realm <number> [<SECTS>]", 0, real, C_MOD, NORM},
|
||||||
{"recon <spy-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION>",
|
{"recon <spy-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION>",
|
||||||
3, reco, C_MOD, NORM + MONEY + CAP},
|
3, reco, C_MOD, NORM + MONEY + CAP},
|
||||||
{"reject <reject|accept> <announcements|mail|treaties|loans> <NAT>",
|
{"reject <reject|accept> <announcements|mail|loans> <NAT>",
|
||||||
2, reje, C_MOD, NORM},
|
2, reje, C_MOD, NORM},
|
||||||
{"relations [as-COUNTRY]", 0, rela, 0, 0},
|
{"relations [as-COUNTRY]", 0, rela, 0, 0},
|
||||||
{"reload", 0, relo, C_MOD, GOD},
|
{"reload", 0, relo, C_MOD, GOD},
|
||||||
|
@ -267,7 +267,6 @@ struct cmndstr player_coms[] = {
|
||||||
{"trade", 1, trad, C_MOD, NORM + MONEY + CAP},
|
{"trade", 1, trad, C_MOD, NORM + MONEY + CAP},
|
||||||
{"transport <\"nuke\"|\"plane\"> <NUKES|PLANES> <PATH|DESTINATION>",
|
{"transport <\"nuke\"|\"plane\"> <NUKES|PLANES> <PATH|DESTINATION>",
|
||||||
1, tran, C_MOD, NORM + CAP},
|
1, tran, C_MOD, NORM + CAP},
|
||||||
{"treaty <TREATIES>", 0, trea, 0, NORM + MONEY + CAP},
|
|
||||||
{"turn <\"on\"|\"off\"|\"mess\">", 0, turn, C_MOD, GOD},
|
{"turn <\"on\"|\"off\"|\"mess\">", 0, turn, C_MOD, GOD},
|
||||||
{"unload <COMM|\"land\"|\"plane\"> <SHIPS> <NUM|UNIT|PLANE>",
|
{"unload <COMM|\"land\"|\"plane\"> <SHIPS> <NUM|UNIT|PLANE>",
|
||||||
1, load, C_MOD, NORM + CAP},
|
1, load, C_MOD, NORM + CAP},
|
||||||
|
|
|
@ -639,14 +639,10 @@ att_approach(struct combat *off, struct combat *def)
|
||||||
|
|
||||||
/* The attack is valid. Tell the attacker about what they're going to hit */
|
/* The attack is valid. Tell the attacker about what they're going to hit */
|
||||||
|
|
||||||
int
|
void
|
||||||
att_show(struct combat *def)
|
att_show(struct combat *def)
|
||||||
{
|
{
|
||||||
/* Note that we tell the player about the treaty BEFORE we tell them
|
|
||||||
about the item. If we didn't, then they gain free information */
|
|
||||||
if (def->type == EF_SECTOR) {
|
if (def->type == EF_SECTOR) {
|
||||||
if (!trechk(player->cnum, def->own, LANATT))
|
|
||||||
return abort_attack();
|
|
||||||
pr("%s is a %d%% %s %s with approximately %d military.\n",
|
pr("%s is a %d%% %s %s with approximately %d military.\n",
|
||||||
xyas(def->x, def->y, player->cnum),
|
xyas(def->x, def->y, player->cnum),
|
||||||
roundintby((int)def->eff, 10),
|
roundintby((int)def->eff, 10),
|
||||||
|
@ -655,19 +651,10 @@ att_show(struct combat *def)
|
||||||
if (map_set(player->cnum, def->x, def->y, def->sct_dcp->d_mnem, 0))
|
if (map_set(player->cnum, def->x, def->y, def->sct_dcp->d_mnem, 0))
|
||||||
writemap(player->cnum);
|
writemap(player->cnum);
|
||||||
} else if (def->type == EF_SHIP || def->type == EF_LAND) {
|
} else if (def->type == EF_SHIP || def->type == EF_LAND) {
|
||||||
if (def->type == EF_SHIP) {
|
|
||||||
if (!trechk(player->cnum, def->own, SEAATT))
|
|
||||||
return abort_attack();
|
|
||||||
} else {
|
|
||||||
if (!trechk(player->cnum, def->own, LNDATT))
|
|
||||||
return abort_attack();
|
|
||||||
}
|
|
||||||
pr("%s is about %d%% efficient and has approximately %d mil on board.\n",
|
pr("%s is about %d%% efficient and has approximately %d mil on board.\n",
|
||||||
prcom(0, def), roundintby((int)def->eff, 10),
|
prcom(0, def), roundintby((int)def->eff, 10),
|
||||||
roundintby(def->troops, 10));
|
roundintby(def->troops, 10));
|
||||||
}
|
}
|
||||||
/* Ok, everything is fine */
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attack and assault ask the user which kind of support they want */
|
/* Attack and assault ask the user which kind of support they want */
|
||||||
|
|
|
@ -38,9 +38,6 @@
|
||||||
* some kind of payment plan...like house payments
|
* some kind of payment plan...like house payments
|
||||||
* and such, where the bucks just get paid up each
|
* and such, where the bucks just get paid up each
|
||||||
* update or so.
|
* update or so.
|
||||||
*
|
|
||||||
* I'd have made this more like treaty if I weren't
|
|
||||||
* so disgusted with how it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
/*
|
|
||||||
* Empire - A multi-player, client/server Internet based war game.
|
|
||||||
* Copyright (C) 1986-2014, Dave Pare, Jeff Bailey, Thomas Ruschak,
|
|
||||||
* Ken Stevens, Steve McClure, Markus Armbruster
|
|
||||||
*
|
|
||||||
* Empire is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* distrea.c: Display treaty information
|
|
||||||
*
|
|
||||||
* Known contributors to this file:
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include "file.h"
|
|
||||||
#include "nat.h"
|
|
||||||
#include "nsc.h"
|
|
||||||
#include "player.h"
|
|
||||||
#include "prototypes.h"
|
|
||||||
#include "treaty.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
distrea(int n, struct trtstr *tp)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int acond, bcond, cond;
|
|
||||||
time_t now;
|
|
||||||
|
|
||||||
if (tp->trt_status == TS_FREE)
|
|
||||||
return 0;
|
|
||||||
if (tp->trt_cna != player->cnum &&
|
|
||||||
tp->trt_cnb != player->cnum && !player->god)
|
|
||||||
return 0;
|
|
||||||
(void)time(&now);
|
|
||||||
if (now > tp->trt_exp) {
|
|
||||||
tp->trt_status = TS_FREE;
|
|
||||||
if (!puttre(n, tp)) {
|
|
||||||
pr("Couldn't save treaty; get help!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
pr("Treaty #%d expired %s", n, ctime(&tp->trt_exp));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
pr("\n * * * Empire Treaty #%d * * *\n", n);
|
|
||||||
if (tp->trt_status == TS_PROPOSED)
|
|
||||||
pr("(proposed)\n");
|
|
||||||
pr("between %s and ", cname(tp->trt_cna));
|
|
||||||
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 = treaty_flags[i].value); i++) {
|
|
||||||
acond = tp->trt_acond & cond;
|
|
||||||
bcond = tp->trt_bcond & cond;
|
|
||||||
if (acond | bcond) {
|
|
||||||
if (acond)
|
|
||||||
pr("%30s", treaty_flags[i].name);
|
|
||||||
else
|
|
||||||
pr("%30s", "");
|
|
||||||
if (bcond)
|
|
||||||
pr(" - %s\n", treaty_flags[i].name);
|
|
||||||
else
|
|
||||||
pr(" -\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
|
@ -102,7 +102,6 @@ ef_open_srv(void)
|
||||||
failed |= !ef_open(EF_GAME, EFF_MEM);
|
failed |= !ef_open(EF_GAME, EFF_MEM);
|
||||||
failed |= !ef_open(EF_NEWS, 0);
|
failed |= !ef_open(EF_NEWS, 0);
|
||||||
failed |= !ef_open(EF_LOAN, 0);
|
failed |= !ef_open(EF_LOAN, 0);
|
||||||
failed |= !ef_open(EF_TREATY, 0);
|
|
||||||
failed |= !ef_open(EF_NUKE, EFF_MEM);
|
failed |= !ef_open(EF_NUKE, EFF_MEM);
|
||||||
failed |= !ef_open(EF_POWER, 0);
|
failed |= !ef_open(EF_POWER, 0);
|
||||||
failed |= !ef_open(EF_TRADE, 0);
|
failed |= !ef_open(EF_TRADE, 0);
|
||||||
|
@ -131,7 +130,6 @@ ef_close_srv(void)
|
||||||
ef_close(EF_GAME);
|
ef_close(EF_GAME);
|
||||||
ef_close(EF_NEWS);
|
ef_close(EF_NEWS);
|
||||||
ef_close(EF_LOAN);
|
ef_close(EF_LOAN);
|
||||||
ef_close(EF_TREATY);
|
|
||||||
ef_close(EF_NUKE);
|
ef_close(EF_NUKE);
|
||||||
ef_close(EF_POWER);
|
ef_close(EF_POWER);
|
||||||
ef_close(EF_TRADE);
|
ef_close(EF_TRADE);
|
||||||
|
|
|
@ -1,132 +0,0 @@
|
||||||
/*
|
|
||||||
* Empire - A multi-player, client/server Internet based war game.
|
|
||||||
* Copyright (C) 1986-2014, Dave Pare, Jeff Bailey, Thomas Ruschak,
|
|
||||||
* Ken Stevens, Steve McClure, Markus Armbruster
|
|
||||||
*
|
|
||||||
* Empire is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* trechk.c: Check to see if an actor has violated a treaty.
|
|
||||||
*
|
|
||||||
* Known contributors to this file:
|
|
||||||
* Steve McClure, 1998-1999
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check to see if an actor has a treaty forbidding a given action,
|
|
||||||
* and if so, see if the actor wishes to break the treaty.
|
|
||||||
* All applicable treaties are checked. All treaties must be broken
|
|
||||||
* if the action is to be allowed. Propsed treaties are warned about,
|
|
||||||
* but no mention of broken pending treaties are made in the news.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include "file.h"
|
|
||||||
#include "nat.h"
|
|
||||||
#include "news.h"
|
|
||||||
#include "optlist.h"
|
|
||||||
#include "prototypes.h"
|
|
||||||
#include "treaty.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
trechk(natid actor, natid victim, int provision)
|
|
||||||
{
|
|
||||||
natid cn;
|
|
||||||
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, &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;
|
|
||||||
}
|
|
|
@ -135,7 +135,6 @@ enlist(short *vec, int etu, int *cost)
|
||||||
int maxmil;
|
int maxmil;
|
||||||
int enlisted;
|
int enlisted;
|
||||||
|
|
||||||
/* Need to check treaties here */
|
|
||||||
enlisted = 0;
|
enlisted = 0;
|
||||||
maxmil = vec[I_CIVIL] / 2 - vec[I_MILIT];
|
maxmil = vec[I_CIVIL] / 2 - vec[I_MILIT];
|
||||||
if (maxmil > 0) {
|
if (maxmil > 0) {
|
||||||
|
|
|
@ -428,9 +428,6 @@ actor action victim times duration time
|
||||||
0 43 2 4 0 0
|
0 43 2 4 0 0
|
||||||
0 33 0 2 0 0
|
0 33 0 2 0 0
|
||||||
/config
|
/config
|
||||||
config treaty
|
|
||||||
uid cna cnb status acond bcond exp
|
|
||||||
/config
|
|
||||||
config trade
|
config trade
|
||||||
uid owner type unitid price maxbidder markettime xloc yloc
|
uid owner type unitid price maxbidder markettime xloc yloc
|
||||||
/config
|
/config
|
||||||
|
|
|
@ -1040,9 +1040,6 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius stockpile p
|
||||||
config news
|
config news
|
||||||
actor action victim times duration time
|
actor action victim times duration time
|
||||||
/config
|
/config
|
||||||
config treaty
|
|
||||||
uid cna cnb status acond bcond exp
|
|
||||||
/config
|
|
||||||
config trade
|
config trade
|
||||||
uid owner type unitid price maxbidder markettime xloc yloc
|
uid owner type unitid price maxbidder markettime xloc yloc
|
||||||
/config
|
/config
|
||||||
|
|
|
@ -1040,9 +1040,6 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius stockpile p
|
||||||
config news
|
config news
|
||||||
actor action victim times duration time
|
actor action victim times duration time
|
||||||
/config
|
/config
|
||||||
config treaty
|
|
||||||
uid cna cnb status acond bcond exp
|
|
||||||
/config
|
|
||||||
config trade
|
config trade
|
||||||
uid owner type unitid price maxbidder markettime xloc yloc
|
uid owner type unitid price maxbidder markettime xloc yloc
|
||||||
/config
|
/config
|
||||||
|
|
|
@ -477,9 +477,6 @@ actor action victim times duration time
|
||||||
1 11 1 2 0 0
|
1 11 1 2 0 0
|
||||||
1 11 2 11 0 0
|
1 11 2 11 0 0
|
||||||
/config
|
/config
|
||||||
config treaty
|
|
||||||
uid cna cnb status acond bcond exp
|
|
||||||
/config
|
|
||||||
config trade
|
config trade
|
||||||
uid owner type unitid price maxbidder markettime xloc yloc
|
uid owner type unitid price maxbidder markettime xloc yloc
|
||||||
/config
|
/config
|
||||||
|
|
|
@ -4,7 +4,7 @@ xdump meta plane
|
||||||
xdump meta land
|
xdump meta land
|
||||||
xdump meta nuke
|
xdump meta nuke
|
||||||
xdump meta news
|
xdump meta news
|
||||||
xdump meta treaty
|
__cmd added -1 0 0
|
||||||
xdump meta trade
|
xdump meta trade
|
||||||
xdump meta nat
|
xdump meta nat
|
||||||
xdump meta loan
|
xdump meta loan
|
||||||
|
@ -45,5 +45,5 @@ xdump meta plane-flags
|
||||||
xdump meta resources
|
xdump meta resources
|
||||||
xdump meta retreat-flags
|
xdump meta retreat-flags
|
||||||
xdump meta ship-chr-flags
|
xdump meta ship-chr-flags
|
||||||
xdump meta treaty-flags
|
__cmd added -1 0 0
|
||||||
xdump meta country
|
xdump meta country
|
||||||
|
|
|
@ -10,7 +10,7 @@ xdump meta plane
|
||||||
xdump meta land
|
xdump meta land
|
||||||
xdump meta nuke
|
xdump meta nuke
|
||||||
xdump meta news
|
xdump meta news
|
||||||
xdump meta treaty
|
__cmd added -1 0 0
|
||||||
xdump meta trade
|
xdump meta trade
|
||||||
xdump meta nat
|
xdump meta nat
|
||||||
xdump meta loan
|
xdump meta loan
|
||||||
|
@ -51,5 +51,5 @@ xdump meta plane-flags
|
||||||
xdump meta resources
|
xdump meta resources
|
||||||
xdump meta retreat-flags
|
xdump meta retreat-flags
|
||||||
xdump meta ship-chr-flags
|
xdump meta ship-chr-flags
|
||||||
xdump meta treaty-flags
|
__cmd added -1 0 0
|
||||||
xdump meta country
|
xdump meta country
|
||||||
|
|
|
@ -4,7 +4,7 @@ xdump plane *
|
||||||
xdump land *
|
xdump land *
|
||||||
xdump nuke *
|
xdump nuke *
|
||||||
xdump news *
|
xdump news *
|
||||||
xdump treaty *
|
__cmd added -1 0 0
|
||||||
xdump trade *
|
xdump trade *
|
||||||
xdump nat *
|
xdump nat *
|
||||||
xdump loan *
|
xdump loan *
|
||||||
|
@ -45,5 +45,5 @@ xdump plane-flags *
|
||||||
xdump resources *
|
xdump resources *
|
||||||
xdump retreat-flags *
|
xdump retreat-flags *
|
||||||
xdump ship-chr-flags *
|
xdump ship-chr-flags *
|
||||||
xdump treaty-flags *
|
__cmd added -1 0 0
|
||||||
xdump country *
|
xdump country *
|
||||||
|
|
|
@ -4,7 +4,7 @@ xdump plane *
|
||||||
xdump land *
|
xdump land *
|
||||||
xdump nuke *
|
xdump nuke *
|
||||||
xdump news *
|
xdump news *
|
||||||
xdump treaty *
|
__cmd added -1 0 0
|
||||||
xdump trade *
|
xdump trade *
|
||||||
xdump nat *
|
xdump nat *
|
||||||
xdump loan *
|
xdump loan *
|
||||||
|
@ -45,5 +45,5 @@ xdump plane-flags *
|
||||||
xdump resources *
|
xdump resources *
|
||||||
xdump retreat-flags *
|
xdump retreat-flags *
|
||||||
xdump ship-chr-flags *
|
xdump ship-chr-flags *
|
||||||
xdump treaty-flags *
|
__cmd added -1 0 0
|
||||||
xdump country *
|
xdump country *
|
||||||
|
|
|
@ -1040,9 +1040,6 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius stockpile p
|
||||||
config news
|
config news
|
||||||
actor action victim times duration time
|
actor action victim times duration time
|
||||||
/config
|
/config
|
||||||
config treaty
|
|
||||||
uid cna cnb status acond bcond exp
|
|
||||||
/config
|
|
||||||
config trade
|
config trade
|
||||||
uid owner type unitid price maxbidder markettime xloc yloc
|
uid owner type unitid price maxbidder markettime xloc yloc
|
||||||
/config
|
/config
|
||||||
|
|
|
@ -1215,9 +1215,6 @@ actor action victim times duration time
|
||||||
1 58 8 1 0 0
|
1 58 8 1 0 0
|
||||||
1 2 8 1 0 0
|
1 2 8 1 0 0
|
||||||
/config
|
/config
|
||||||
config treaty
|
|
||||||
uid cna cnb status acond bcond exp
|
|
||||||
/config
|
|
||||||
config trade
|
config trade
|
||||||
uid owner type unitid price maxbidder markettime xloc yloc
|
uid owner type unitid price maxbidder markettime xloc yloc
|
||||||
/config
|
/config
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue