34 const struct player *pplayer2)
53 log_error(
"%s(): Unsupported diplomacy variant %d.",
62 const struct player *aplayer)
82 const struct player *aplayer)
103 ptreaty->
clauses = clause_list_new();
114 clause_list_destroy(ptreaty->
clauses);
121 enum clause_type
type,
int val)
124 if (pclause->type ==
type && pclause->from == pfrom
125 && pclause->value == val) {
126 clause_list_remove(ptreaty->
clauses, pclause);
143 enum clause_type
type,
int val,
149 enum diplstate_type ds
152 if (!clause_type_is_valid(
type)) {
153 log_error(
"Illegal clause type encountered.");
158 log_error(
"Illegal tech value %i in clause.", val);
163 && ((ds == DS_PEACE &&
type == CLAUSE_PEACE)
164 || (ds == DS_ARMISTICE &&
type == CLAUSE_PEACE)
165 || (ds == DS_ALLIANCE &&
type == CLAUSE_ALLIANCE)
166 || (ds == DS_CEASEFIRE &&
type == CLAUSE_CEASEFIRE))) {
168 log_error(
"Illegal treaty suggested between %s and %s - they "
169 "already have this treaty level.",
177 log_error(
"Illegal embassy clause: %s already have embassy with %s.",
204 if (old_clause->type ==
type
205 && old_clause->from == pfrom
206 && old_clause->value == val) {
215 old_clause->type =
type;
218 if (
type == CLAUSE_GOLD && old_clause->type == CLAUSE_GOLD
219 && old_clause->from == pfrom) {
223 old_clause->value = val;
231 pclause->
from = pfrom;
232 pclause->
value = val;
234 clause_list_append(ptreaty->
clauses, pclause);
249 for (i = 0; i < CLAUSE_COUNT; i++) {
253 requirement_vector_init(&(
clause_infos[i].receiver_reqs));
264 for (i = 0; i < CLAUSE_COUNT; i++) {
266 requirement_vector_free(&(
clause_infos[i].receiver_reqs));
bool diplomacy_possible(const struct player *pplayer1, const struct player *pplayer2)
void clause_infos_init(void)
void clause_infos_free(void)
void clear_treaty(struct Treaty *ptreaty)
void init_treaty(struct Treaty *ptreaty, struct player *plr0, struct player *plr1)
bool add_clause(struct Treaty *ptreaty, struct player *pfrom, enum clause_type type, int val, struct player *client_player)
bool clause_enabled(enum clause_type type)
static struct clause_info clause_infos[CLAUSE_COUNT]
bool remove_clause(struct Treaty *ptreaty, struct player *pfrom, enum clause_type type, int val)
bool could_intel_with_player(const struct player *pplayer, const struct player *aplayer)
struct clause_info * clause_info_get(enum clause_type type)
bool could_meet_with_player(const struct player *pplayer, const struct player *aplayer)
#define clause_list_iterate_end
#define clause_list_iterate(clauselist, pclause)
#define is_pact_clause(x)
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
#define fc_assert(condition)
#define log_error(message,...)
const char * nation_rule_name(const struct nation_type *pnation)
struct nation_type * nation_of_player(const struct player *pplayer)
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
bool player_has_real_embassy(const struct player *pplayer, const struct player *pplayer2)
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
bool player_has_embassy(const struct player *pplayer, const struct player *pplayer2)
bool are_reqs_active(const struct req_context *context, const struct player *other_player, const struct requirement_vector *reqs, const enum req_problem_type prob_type)
struct clause_list * clauses
struct packet_game_info info
struct requirement_vector receiver_reqs
struct requirement_vector giver_reqs
enum diplomacy_mode diplomacy
struct advance * valid_advance_by_number(const Tech_type_id id)