]> git.pond.sub.org Git - empserver/blob - include/treaty.h
90d362e607052a4c7ac876a0eed2b3aa8a07fa96
[empserver] / include / treaty.h
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                Ken Stevens, Steve McClure, Markus Armbruster
5  *
6  *  Empire is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation, either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  *  ---
20  *
21  *  See files README, COPYING and CREDITS in the root of the source
22  *  tree for related information and legal notices.  It is expected
23  *  that future projects/authors will amend these files as needed.
24  *
25  *  ---
26  *
27  *  treaty.h: Definitions for treaties
28  *
29  *  Known contributors to this file:
30  *     Steve McClure, 1998
31  */
32
33 #ifndef TREATY_H
34 #define TREATY_H
35
36 #include <time.h>
37 #include "types.h"
38
39 struct trtstr {
40     /* initial part must match struct empobj */
41     signed ef_type: 8;
42     unsigned trt_seqno: 12;
43     unsigned trt_generation: 12;
44     int trt_uid;
45     time_t trt_timestamp;
46     /* end of part matching struct empobj */
47     natid trt_cna;              /* proposer */
48     natid trt_cnb;              /* acceptor */
49     signed char trt_status;     /* treaty status */
50     char trt_fill;
51     short trt_acond;            /* conditions for proposer */
52     short trt_bcond;            /* conditions for accepter */
53     time_t trt_exp;             /* expiration date */
54 };
55
56 #define TS_FREE         AGREE_FREE
57 #define TS_PROPOSED     AGREE_PROPOSED
58 #define TS_SIGNED       AGREE_SIGNED
59
60         /* treaty clauses */
61 #define LNDATT  bit(0)          /* no attacks on land units */
62 #define SEAATT  bit(1)          /* no attacks on ships */
63 #define SEAFIR  bit(2)          /* no shelling ships */
64 #define LANATT  bit(3)          /* no attacks on sectors */
65 #define LANFIR  bit(4)          /* no shelling sectors */
66 #define NEWSHP  bit(5)          /* no new ships */
67 #define NEWNUK  bit(6)          /* no new nuclear weapons */
68 #define NEWPLN  bit(7)          /* no new planes */
69 #define NEWLND  bit(8)          /* no new land units */
70 #define TRTENL  bit(9)          /* no enlistment */
71 #define SUBFIR  bit(10)         /* no depth-charging submarines */
72
73 #define gettre(n, p) ef_read(EF_TREATY, (n), (p))
74 #define puttre(n, p) ef_write(EF_TREATY, (n), (p))
75 #define gettrep(n) ((struct trtstr *)ef_ptr(EF_TREATY, (n)))
76
77 #endif