1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
13 #ifndef FC__DIPTREATY_H
14 #define FC__DIPTREATY_H
18 #endif /* __cplusplus */
20 #include "support.h" /* bool type */
22 /* Used in the network protocol */
23 #define SPECENUM_NAME clause_type
24 #define SPECENUM_VALUE0 CLAUSE_ADVANCE
25 #define SPECENUM_VALUE0NAME "Advance"
26 #define SPECENUM_VALUE1 CLAUSE_GOLD
27 #define SPECENUM_VALUE1NAME "Gold"
28 #define SPECENUM_VALUE2 CLAUSE_MAP
29 #define SPECENUM_VALUE2NAME "Map"
30 #define SPECENUM_VALUE3 CLAUSE_SEAMAP
31 #define SPECENUM_VALUE3NAME "Seamap"
32 #define SPECENUM_VALUE4 CLAUSE_CITY
33 #define SPECENUM_VALUE4NAME "City"
34 #define SPECENUM_VALUE5 CLAUSE_CEASEFIRE
35 #define SPECENUM_VALUE5NAME "Ceasefire"
36 #define SPECENUM_VALUE6 CLAUSE_PEACE
37 #define SPECENUM_VALUE6NAME "Peace"
38 #define SPECENUM_VALUE7 CLAUSE_ALLIANCE
39 #define SPECENUM_VALUE7NAME "Alliance"
40 #define SPECENUM_VALUE8 CLAUSE_VISION
41 #define SPECENUM_VALUE8NAME "Vision"
42 #define SPECENUM_VALUE9 CLAUSE_EMBASSY
43 #define SPECENUM_VALUE9NAME "Embassy"
44 #include "specenum_gen.h"
46 #define is_pact_clause(x) \
47 ((x == CLAUSE_CEASEFIRE) || (x == CLAUSE_PEACE) || (x == CLAUSE_ALLIANCE))
49 /* For when we need to iterate over treaties */
51 #define SPECLIST_TAG clause
52 #define SPECLIST_TYPE struct Clause
55 #define clause_list_iterate(clauselist, pclause) \
56 TYPED_LIST_ITERATE(struct Clause, clauselist, pclause)
57 #define clause_list_iterate_end LIST_ITERATE_END
60 enum clause_type type
;
66 struct player
*plr0
, *plr1
;
67 bool accept0
, accept1
;
68 struct clause_list
*clauses
;
71 bool diplomacy_possible(const struct player
*pplayer
,
72 const struct player
*aplayer
);
73 bool could_meet_with_player(const struct player
*pplayer
,
74 const struct player
*aplayer
);
75 bool could_intel_with_player(const struct player
*pplayer
,
76 const struct player
*aplayer
);
78 void init_treaty(struct Treaty
*ptreaty
,
79 struct player
*plr0
, struct player
*plr1
);
80 bool add_clause(struct Treaty
*ptreaty
, struct player
*pfrom
,
81 enum clause_type type
, int val
);
82 bool remove_clause(struct Treaty
*ptreaty
, struct player
*pfrom
,
83 enum clause_type type
, int val
);
84 void clear_treaty(struct Treaty
*ptreaty
);
88 #endif /* __cplusplus */
90 #endif /* FC__DIPTREATY_H */