Freeciv-3.4
Loading...
Searching...
No Matches
diplhand.c
Go to the documentation of this file.
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)
6 any later version.
7
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
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <stdio.h>
19#include <stdlib.h>
20
21/* utility */
22#include "bitvector.h"
23#include "fcintl.h"
24#include "log.h"
25#include "mem.h"
26
27/* common */
28#include "ai.h"
29#include "diptreaty.h"
30#include "events.h"
31#include "game.h"
32#include "map.h"
33#include "packets.h"
34#include "player.h"
35#include "research.h"
36#include "unit.h"
37
38/* common/scriptcore */
39#include "luascript_types.h"
40
41/* server */
42#include "citytools.h"
43#include "cityturn.h"
44#include "maphand.h"
45#include "plrhand.h"
46#include "notify.h"
47#include "techtools.h"
48#include "unittools.h"
49
50/* server/scripting */
51#include "script_server.h"
52
53#include "diplhand.h"
54
55/**********************************************************************/
58static void call_treaty_evaluate(struct player *pplayer, struct player *aplayer,
59 struct treaty *ptreaty)
60{
61 if (is_ai(pplayer)) {
62 CALL_PLR_AI_FUNC(treaty_evaluate, pplayer, pplayer, aplayer, ptreaty);
63 }
64}
65
66/**********************************************************************/
69static void call_treaty_accepted(struct player *pplayer, struct player *aplayer,
70 struct treaty *ptreaty)
71{
72 if (is_ai(pplayer)) {
73 CALL_PLR_AI_FUNC(treaty_accepted, pplayer, pplayer, aplayer, ptreaty);
74 }
75}
76
77/**********************************************************************/
81 enum diplstate_type b)
82{
83 static const int how_close[DS_LAST] = {
84 [DS_NO_CONTACT] = 0,
85 [DS_WAR] = 1,
86 [DS_CEASEFIRE] = 2,
87 [DS_ARMISTICE] = 3,
88 [DS_PEACE] = 4,
89 [DS_ALLIANCE] = 5,
90 [DS_TEAM] = 6,
91 };
92
93 if (how_close[a] < how_close[b]) {
94 return b;
95 } else {
96 return a;
97 }
98}
99
100/**********************************************************************/
105{
106 if (dst_closest(dst->type, dst->max_state) == dst->max_state) {
107 /* Sane max_state */
108 return dst->max_state;
109 }
110
111 /* max_state illegally lower than current. Return current as max_state */
112 return dst->type;
113}
114
115/**********************************************************************/
119 struct player_diplstate *state2,
120 enum diplstate_type type)
121{
122 enum diplstate_type max;
123
124 if (type == DS_ARMISTICE) {
125 max = DS_PEACE;
126 } else {
127 max = type;
128 }
129
130 max = dst_closest(max, state1->max_state);
131
132 state1->type = type;
133 state2->type = type;
134 state1->max_state = max;
135 state2->max_state = max;
136}
137
138/**********************************************************************/
144 int counterpart)
145{
146 struct treaty *ptreaty;
150 struct player *pother = player_by_number(counterpart);
151
152 const struct req_context player_ctxt = { .player = pplayer };
153 const struct req_context other_ctxt = { .player = pother };
154
155 if (NULL == pother || pplayer == pother) {
156 return;
157 }
158
159 ptreaty = find_treaty(pplayer, pother);
160
161 if (!ptreaty) {
162 return;
163 }
164
165 if (ptreaty->plr0 == pplayer) {
168 } else {
171 }
172
173 if (!*player_accept) { /* Tries to accept. */
174
175 /* Check that player who accepts can keep what they promise. */
176
178 struct city *pcity = NULL;
179
180 if (pclause->from == pplayer) {
181 struct clause_info *info = clause_info_get(pclause->type);
182
184 &(info->giver_reqs), RPT_POSSIBLE)
186 &(info->receiver_reqs), RPT_POSSIBLE)) {
187 log_error("Requirements of a clause between %s and %s not fulfilled",
188 player_name(pplayer), player_name(pother));
189 return;
190 }
191 }
192
193 if (pclause->from == pplayer || is_pact_clause(pclause->type)) {
194 switch (pclause->type) {
195 case CLAUSE_EMBASSY:
196 if (player_has_real_embassy(pother, pplayer)) {
197 log_error("%s tried to give embassy to %s, who already "
198 "has an embassy",
199 player_name(pplayer), player_name(pother));
200 return;
201 }
202 break;
203 case CLAUSE_ADVANCE:
206 /* It is impossible to give a technology to a civilization that
207 * can not possess it (the client should enforce this). */
208 log_error("Treaty: %s can't have tech %s",
212 _("The %s can't accept %s."),
215 (pclause->value)));
216 return;
217 }
218 if (research_invention_state(research_get(pplayer), pclause->value)
219 != TECH_KNOWN) {
220 log_error("Nation %s try to give unknown tech %s to nation %s.",
225 _("You don't have tech %s, you can't accept treaty."),
227 (pclause->value)));
228 return;
229 }
230 break;
231 case CLAUSE_CITY:
233 if (!pcity) { /* Can't find out cityname any more. */
235 _("City you are trying to give no longer exists, "
236 "you can't accept treaty."));
237 return;
238 }
239 if (city_owner(pcity) != pplayer) {
241 _("You are not owner of %s, you can't accept treaty."),
243 return;
244 }
245 if (is_capital(pcity)) {
247 _("Your capital (%s) is requested, "
248 "you can't accept treaty."),
250 return;
251 }
252 break;
253 case CLAUSE_CEASEFIRE:
255 if (diplcheck != DIPL_OK) {
256 return;
257 }
258 break;
259 case CLAUSE_PEACE:
261 if (diplcheck != DIPL_OK) {
262 return;
263 }
264 break;
265 case CLAUSE_ALLIANCE:
269 _("You cannot form an alliance because you are "
270 "at war with an ally of %s."),
274 _("You cannot form an alliance because %s is "
275 "at war with an ally of yours."),
277 }
278 if (diplcheck != DIPL_OK) {
279 return;
280 }
281 break;
282 case CLAUSE_GOLD:
283 if (pplayer->economic.gold < pclause->value) {
285 _("You don't have enough gold, "
286 "you can't accept treaty."));
287 return;
288 }
289 break;
290 case CLAUSE_MAP:
291 case CLAUSE_SEAMAP:
292 case CLAUSE_VISION:
294 case CLAUSE_COUNT:
295 break;
296 }
297 }
299 }
300
302
305 *other_accept);
307 player_number(pplayer), *other_accept,
309
310 if (ptreaty->accept0 && ptreaty->accept1) {
312
315 player_number(pplayer));
317 player_number(pplayer),
318 player_number(pplayer));
319
321 PL_("A treaty containing %d clause was agreed upon.",
322 "A treaty containing %d clauses was agreed upon.",
323 nclauses),
324 nclauses);
326 PL_("A treaty containing %d clause was agreed upon.",
327 "A treaty containing %d clauses was agreed upon.",
328 nclauses),
329 nclauses);
330
331 /* Check that one who accepted treaty earlier still have everything
332 they promised to give. */
333
335 struct city *pcity;
336
337 if (pclause->from == pother) {
338 struct clause_info *info = clause_info_get(pclause->type);
339
341 &(info->giver_reqs), RPT_POSSIBLE)
343 &(info->receiver_reqs), RPT_POSSIBLE)) {
345 _("Clause requirements are no longer fulfilled. "
346 "Treaty with %s canceled!"),
349 _("Clause requirements are no longer fulfilled. "
350 "Treaty with %s canceled!"),
351 nation_plural_for_player(pplayer));
352 return;
353 }
354 }
355
356 if (pclause->from == pother) {
357 switch (pclause->type) {
358 case CLAUSE_CITY:
360 if (!pcity) { /* Can't find out cityname any more. */
362 _("One of the cities the %s are giving away"
363 " is destroyed! Treaty canceled!"),
366 _("One of the cities the %s are giving away"
367 " is destroyed! Treaty canceled!"),
369 goto cleanup;
370 }
371 if (city_owner(pcity) != pother) {
373 _("The %s no longer control %s! "
374 "Treaty canceled!"),
378 _("The %s no longer control %s! "
379 "Treaty canceled!"),
382 goto cleanup;
383 }
384 if (is_capital(pcity)) {
386 _("Your capital (%s) is requested, "
387 "you can't accept treaty."),
389 goto cleanup;
390 }
391
392 break;
393 case CLAUSE_ALLIANCE:
394 /* We need to recheck this way since things might have
395 * changed. */
397 if (diplcheck != DIPL_OK) {
398 goto cleanup;
399 }
400 break;
401 case CLAUSE_PEACE:
403 if (diplcheck != DIPL_OK) {
404 goto cleanup;
405 }
406 break;
407 case CLAUSE_CEASEFIRE:
409 if (diplcheck != DIPL_OK) {
410 goto cleanup;
411 }
412 break;
413 case CLAUSE_GOLD:
414 if (pother->economic.gold < pclause->value) {
416 _("The %s don't have the promised amount "
417 "of gold! Treaty canceled!"),
420 _("The %s don't have the promised amount "
421 "of gold! Treaty canceled!"),
423 goto cleanup;
424 }
425 break;
426 default:
427 ; /* nothing */
428 }
429 }
431
434
436 struct player *pgiver = pclause->from;
437 struct player *pdest = (pplayer == pgiver) ? pother : pplayer;
443 struct unit_list *pgiver_seen_units BAD_HEURISTIC_INIT(NULL);
444 struct unit_list *pdest_seen_units BAD_HEURISTIC_INIT(NULL);
445
446 switch (pclause->type) {
447 case CLAUSE_EMBASSY:
448 establish_embassy(pdest, pgiver); /* sic */
450 _("You gave an embassy to %s."),
453 _("%s allowed you to create an embassy!"),
455 break;
456 case CLAUSE_ADVANCE:
457 {
458 /* It is possible that two players open the diplomacy dialog
459 * and try to give us the same tech at the same time. This
460 * should be handled discreetly instead of giving a core dump. */
462 const char *advance_name;
463
465 == TECH_KNOWN) {
466 log_verbose("Nation %s already know tech %s, "
467 "that %s want to give them.",
471 break;
472 }
474 (pclause->value));
476 _("You are taught the knowledge of %s."),
478
479 if (tech_transfer(pdest, pgiver, pclause->value)) {
480 char research_name[MAX_LEN_NAME * 2];
481
483 sizeof(research_name));
485 _("You have acquired %s thanks to the %s "
486 "treaty with the %s."),
492 /* TRANS: Tech from another player */
493 Q_("?fromplr:The %s have acquired %s from the %s."),
497
499 advance_by_number(pclause->value), "traded");
503 }
504 }
505 break;
506 case CLAUSE_GOLD:
507 {
508 int received = pclause->value
509 * (100 - game.server.diplgoldcost) / 100;
510 pgiver->economic.gold -= pclause->value;
511 pdest->economic.gold += received;
513 PL_("You get %d gold.",
514 "You get %d gold.", received), received);
515 }
516 break;
517 case CLAUSE_MAP:
520 /* TRANS: ... Polish worldmap. */
521 _("You receive the %s worldmap."),
523
524 worker_refresh_required = TRUE; /* See CLAUSE_VISION */
525 break;
526 case CLAUSE_SEAMAP:
529 /* TRANS: ... Polish seamap. */
530 _("You receive the %s seamap."),
532
533 worker_refresh_required = TRUE; /* See CLAUSE_VISION */
534 break;
535 case CLAUSE_CITY:
536 {
537 struct city *pcity = game_city_by_number(pclause->value);
538
539 if (!pcity) {
540 log_error("Treaty city id %d not found - skipping clause.",
541 pclause->value);
542 break;
543 }
544
546 _("You receive the city of %s from %s."),
548
550 _("You give the city of %s to %s."),
552
554 !is_barbarian(pdest))) {
555 script_server_signal_emit("city_transferred", pcity, pgiver,
556 pdest, "trade");
557 }
558 break;
559 }
560 case CLAUSE_CEASEFIRE:
561 if (old_diplstate == DS_ALLIANCE) {
564 }
569 _("You agree on a cease-fire with %s."),
572 _("You agree on a cease-fire with %s."),
574 if (old_diplstate == DS_ALLIANCE) {
580 }
581
583 break;
584 case CLAUSE_PEACE:
585 if (old_diplstate == DS_ALLIANCE) {
588 }
593 /* TRANS: ... the Poles ... Polish territory */
594 PL_("You agree on an armistice with the %s. In %d turn, "
595 "it will become a peace treaty. Move your "
596 "military units out of %s territory to avoid them "
597 "being disbanded.",
598 "You agree on an armistice with the %s. In %d turns, "
599 "it will become a peace treaty. Move any "
600 "military units out of %s territory to avoid them "
601 "being disbanded.",
607 /* TRANS: ... the Poles ... Polish territory */
608 PL_("You agree on an armistice with the %s. In %d turn, "
609 "it will become a peace treaty. Move your "
610 "military units out of %s territory to avoid them "
611 "being disbanded.",
612 "You agree on an armistice with the %s. In %d turns, "
613 "it will become a peace treaty. Move any "
614 "military units out of %s territory to avoid them "
615 "being disbanded.",
620 if (old_diplstate == DS_ALLIANCE) {
626 }
627
629 break;
630 case CLAUSE_ALLIANCE:
633 _("You agree on an alliance with %s."),
636 _("You agree on an alliance with %s."),
640
642 break;
643 case CLAUSE_VISION:
646 _("You give shared vision to %s."),
649 _("%s gives you shared vision."),
651
652 /* Yes, shared vision may let us to _know_ tiles
653 * within radius of our own city. */
655 break;
657 BV_SET(pgiver->gives_shared_tiles, player_index(pdest));
659 _("You share your tiles with %s."),
662 _("%s shares their tiles with you."),
665 break;
666 case CLAUSE_COUNT:
668 break;
669 }
670
672
673 /* In theory, we would need refresh only receiving party of
674 * CLAUSE_MAP, CLAUSE_SEAMAP and CLAUSE_VISION clauses.
675 * It's quite unlikely that there is such a clause going one
676 * way but no clauses affecting both parties or going other
677 * way. */
681 sync_cities();
682 }
683
684 cleanup:
686 send_player_all_c(pplayer, NULL);
688 }
689}
690
691/**********************************************************************/
694void establish_embassy(struct player *pplayer, struct player *aplayer)
695{
696 /* Establish the embassy. */
698
700 /* Knowledge that pplayer has an embassy now */
702 /* INFO_EMBASSY level info */
703 send_player_all_c(aplayer, teammate->connections);
705
706 /* update player dialog with embassy */
708
709 /* Send research info */
711}
712
713/**********************************************************************/
717 int counterpart, int giver,
718 enum clause_type type, int value)
719{
720 struct treaty *ptreaty;
721 struct player *pgiver = player_by_number(giver);
722 struct player *pother = player_by_number(counterpart);
723
724 if (NULL == pother || pplayer == pother || NULL == pgiver) {
725 return;
726 }
727
728 if (pgiver != pplayer && pgiver != pother) {
729 return;
730 }
731
732 ptreaty = find_treaty(pplayer, pother);
733
734 if (ptreaty && remove_clause(ptreaty, pgiver, type, value)) {
736 player_number(pother), giver, type,
737 value);
739 player_number(pplayer), giver, type,
740 value);
743 }
744}
745
746/**********************************************************************/
750 int counterpart, int giver,
751 enum clause_type type, int value)
752{
753 struct treaty *ptreaty;
754 struct player *pgiver = player_by_number(giver);
755 struct player *pother = player_by_number(counterpart);
756
757 if (NULL == pother || pplayer == pother || NULL == pgiver) {
758 return;
759 }
760
761 if (pgiver != pplayer && pgiver != pother) {
762 return;
763 }
764
765 ptreaty = find_treaty(pplayer, pother);
766
767 if (ptreaty != NULL
768 && add_clause(ptreaty, pgiver, type, value, NULL)) {
769 /*
770 * If we are trading cities, then it is possible that
771 * the dest is unaware of it's existence. We have 2 choices,
772 * forbid it, or lighten that area. If we assume that
773 * the giver knows what they are doing, then 2. is the
774 * most powerful option - I'll choose that for now.
775 * - Kris Bubendorfer
776 */
777 if (type == CLAUSE_CITY) {
778 struct city *pcity = game_city_by_number(value);
779
782 }
783 }
784
786 player_number(pother), giver, type,
787 value);
789 player_number(pplayer), giver, type,
790 value);
793 }
794}
795
796/**********************************************************************/
800static void really_diplomacy_cancel_meeting(struct player *pplayer,
801 struct player *pother)
802{
803 struct treaty *ptreaty = find_treaty(pplayer, pother);
804
805 if (ptreaty) {
807 player_number(pplayer),
808 player_number(pplayer));
810 _("%s canceled the meeting!"),
811 player_name(pplayer));
812 /* Need to send to pplayer too, for multi-connects: */
815 player_number(pplayer));
817 _("Meeting with %s canceled."),
820 }
821}
822
823/**********************************************************************/
827 int counterpart)
828{
829 struct player *pother = player_by_number(counterpart);
830
831 if (NULL == pother || pplayer == pother) {
832 return;
833 }
834
836}
837
838/**********************************************************************/
842 int counterpart)
843{
844 struct player *pother = player_by_number(counterpart);
845
846 if (NULL == pother || pplayer == pother) {
847 return;
848 }
849
850 if (find_treaty(pplayer, pother)) {
851 return;
852 }
853
854 if (get_player_bonus(pplayer, EFT_NO_DIPLOMACY) > 0
857 _("Your diplomatic envoy was decapitated!"));
858 return;
859 }
860
861 if (could_meet_with_player(pplayer, pother)) {
862 struct treaty *ptreaty;
863
864 ptreaty = fc_malloc(sizeof(*ptreaty));
865 init_treaty(ptreaty, pplayer, pother);
867
870 player_number(pplayer));
872 player_number(pplayer),
873 player_number(pplayer));
874 }
875}
876
877/**********************************************************************/
882{
883 struct player *pplayer = dest->playing;
884
885 if (!pplayer) {
886 return;
887 }
889 struct treaty *ptreaty = find_treaty(pplayer, other);
890
891 if (ptreaty) {
892 fc_assert_action(pplayer != other, continue);
894 player_number(pplayer));
898 player_number(pclause->from),
899 pclause->type,
900 pclause->value);
902
903 if (ptreaty->plr0 == pplayer) {
907 } else {
911 }
912 }
914}
915
916/**********************************************************************/
919void cancel_all_meetings(struct player *pplayer)
920{
922 if (find_treaty(pplayer, pplayer2)) {
924 }
926}
927
928/**********************************************************************/
931void reject_all_treaties(struct player *pplayer)
932{
933 struct treaty *treaty;
934
936 treaty = find_treaty(pplayer, pplayer2);
937 if (treaty == nullptr) {
938 continue;
939 }
944 FALSE,
945 FALSE);
947 player_number(pplayer),
948 FALSE,
949 FALSE);
951}
#define CALL_PLR_AI_FUNC(_func, _player,...)
Definition ai.h:380
#define BV_SET(bv, bit)
Definition bitvector.h:89
bool is_capital(const struct city *pcity)
Definition city.c:1632
#define city_tile(_pcity_)
Definition city.h:565
#define city_owner(_pcity_)
Definition city.h:564
void sync_cities(void)
Definition citytools.c:3364
void city_map_update_all_cities_for_player(struct player *pplayer)
Definition citytools.c:3398
bool transfer_city(struct player *ptaker, struct city *pcity, int kill_outside, bool transfer_unit_verbose, bool resolve_stack, bool raze, bool build_free)
Definition citytools.c:1077
char * incite_cost
Definition comments.c:77
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:77
void establish_embassy(struct player *pplayer, struct player *aplayer)
Definition diplhand.c:694
void send_diplomatic_meetings(struct connection *dest)
Definition diplhand.c:881
static void call_treaty_accepted(struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
Definition diplhand.c:69
void handle_diplomacy_remove_clause_req(struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
Definition diplhand.c:716
void handle_diplomacy_create_clause_req(struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
Definition diplhand.c:749
void reject_all_treaties(struct player *pplayer)
Definition diplhand.c:931
enum diplstate_type valid_dst_closest(struct player_diplstate *dst)
Definition diplhand.c:104
static void call_treaty_evaluate(struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
Definition diplhand.c:58
void set_diplstate_type(struct player_diplstate *state1, struct player_diplstate *state2, enum diplstate_type type)
Definition diplhand.c:118
void handle_diplomacy_init_meeting_req(struct player *pplayer, int counterpart)
Definition diplhand.c:841
void cancel_all_meetings(struct player *pplayer)
Definition diplhand.c:919
void handle_diplomacy_cancel_meeting_req(struct player *pplayer, int counterpart)
Definition diplhand.c:826
static enum diplstate_type dst_closest(enum diplstate_type a, enum diplstate_type b)
Definition diplhand.c:80
static void really_diplomacy_cancel_meeting(struct player *pplayer, struct player *pother)
Definition diplhand.c:800
void handle_diplomacy_accept_treaty_req(struct player *pplayer, int counterpart)
Definition diplhand.c:143
struct treaty * ptreaty
Definition diplodlg_g.h:28
void treaty_remove(struct treaty *ptreaty)
Definition diptreaty.c:385
void treaty_add(struct treaty *ptreaty)
Definition diptreaty.c:377
struct treaty * find_treaty(struct player *plr0, struct player *plr1)
Definition diptreaty.c:362
void init_treaty(struct treaty *ptreaty, struct player *plr0, struct player *plr1)
Definition diptreaty.c:99
bool add_clause(struct treaty *ptreaty, struct player *pfrom, enum clause_type type, int val, struct player *client_player)
Definition diptreaty.c:145
bool remove_clause(struct treaty *ptreaty, struct player *pfrom, enum clause_type type, int val)
Definition diptreaty.c:123
struct clause_info * clause_info_get(enum clause_type type)
Definition diptreaty.c:292
bool could_meet_with_player(const struct player *pplayer, const struct player *aplayer)
Definition diptreaty.c:64
#define clause_list_iterate_end
Definition diptreaty.h:73
#define clause_list_iterate(clauselist, pclause)
Definition diptreaty.h:71
#define is_pact_clause(x)
Definition diptreaty.h:53
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Definition effects.c:824
@ RPT_POSSIBLE
Definition fc_types.h:515
#define MAX_LEN_NAME
Definition fc_types.h:68
#define Q_(String)
Definition fcintl.h:70
#define PL_(String1, String2, n)
Definition fcintl.h:71
#define _(String)
Definition fcintl.h:67
const struct ft_color ftc_server
const char * city_link(const struct city *pcity)
struct civ_game game
Definition game.c:62
struct city * game_city_by_number(int id)
Definition game.c:106
GType type
Definition repodlgs.c:1313
#define log_verbose(message,...)
Definition log.h:110
#define fc_assert(condition)
Definition log.h:177
#define fc_assert_action(condition, action)
Definition log.h:188
#define log_error(message,...)
Definition log.h:104
void dlsend_packet_diplomacy_init_meeting(struct conn_list *dest, int counterpart, int initiated_from)
void dlsend_packet_diplomacy_remove_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
int dsend_packet_diplomacy_create_clause(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
int dsend_packet_diplomacy_init_meeting(struct connection *pc, int counterpart, int initiated_from)
void dlsend_packet_diplomacy_create_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
void dlsend_packet_diplomacy_accept_treaty(struct conn_list *dest, int counterpart, bool I_accepted, bool other_accepted)
void dlsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, int counterpart, int initiated_from)
int dsend_packet_diplomacy_accept_treaty(struct connection *pc, int counterpart, bool I_accepted, bool other_accepted)
void give_map_from_player_to_player(struct player *pfrom, struct player *pdest)
Definition maphand.c:383
void give_seamap_from_player_to_player(struct player *pfrom, struct player *pdest)
Definition maphand.c:399
void give_citymap_from_player_to_player(struct city *pcity, struct player *pfrom, struct player *pdest)
Definition maphand.c:417
bool map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
Definition maphand.c:937
void give_shared_vision(struct player *pfrom, struct player *pto)
Definition maphand.c:1650
#define fc_malloc(sz)
Definition mem.h:34
const char * nation_rule_name(const struct nation_type *pnation)
Definition nation.c:138
const char * nation_adjective_for_player(const struct player *pplayer)
Definition nation.c:169
struct nation_type * nation_of_player(const struct player *pplayer)
Definition nation.c:443
const char * nation_plural_for_player(const struct player *pplayer)
Definition nation.c:178
void notify_research(const struct research *presearch, const struct player *exclude, enum event_type event, const struct ft_color color, const char *format,...)
Definition notify.c:393
void notify_player(const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
Definition notify.c:291
void notify_research_embassies(const struct research *presearch, const struct player *exclude, enum event_type event, const struct ft_color color, const char *format,...)
Definition notify.c:433
struct player * player_by_number(const int player_id)
Definition player.c:837
int player_number(const struct player *pplayer)
Definition player.c:826
enum dipl_reason pplayer_can_make_treaty(const struct player *p1, const struct player *p2, enum diplstate_type treaty)
Definition player.c:164
const char * player_name(const struct player *pplayer)
Definition player.c:885
bool player_has_real_embassy(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:245
int player_index(const struct player *pplayer)
Definition player.c:818
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:325
#define players_iterate_end
Definition player.h:552
dipl_reason
Definition player.h:192
@ DIPL_ALLIANCE_PROBLEM_THEM
Definition player.h:194
@ DIPL_ALLIANCE_PROBLEM_US
Definition player.h:194
@ DIPL_OK
Definition player.h:193
#define players_iterate(_pplayer)
Definition player.h:547
#define player_list_iterate(playerlist, pplayer)
Definition player.h:570
static bool is_barbarian(const struct player *pplayer)
Definition player.h:499
#define is_ai(plr)
Definition player.h:232
#define player_list_iterate_end
Definition player.h:572
void send_player_all_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1131
void update_players_after_alliance_breakup(struct player *pplayer, struct player *pplayer2, const struct unit_list *pplayer_seen_units, const struct unit_list *pplayer2_seen_units)
Definition plrhand.c:804
bool are_reqs_active(const struct req_context *context, const struct req_context *other_context, const struct requirement_vector *reqs, const enum req_problem_type prob_type)
struct research * research_get(const struct player *pplayer)
Definition research.c:130
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Definition research.c:622
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
Definition research.c:696
int research_pretty_name(const struct research *presearch, char *buf, size_t buf_len)
Definition research.c:171
void script_server_signal_emit(const char *signal_name,...)
#define BAD_HEURISTIC_INIT(_ini_val_)
Definition shared.h:41
Definition city.h:318
int diplgoldcost
Definition game.h:147
struct packet_game_info info
Definition game.h:89
int diplbulbcost
Definition game.h:146
struct civ_game::@32::@36 server
struct requirement_vector receiver_reqs
Definition diptreaty.h:61
struct requirement_vector giver_reqs
Definition diptreaty.h:60
struct player * playing
Definition connection.h:151
bool tech_trade_allow_holes
enum diplstate_type max_state
Definition player.h:200
enum diplstate_type type
Definition player.h:199
struct team * team
Definition player.h:261
struct conn_list * connections
Definition player.h:298
bv_player real_embassy
Definition player.h:277
struct player_economic economic
Definition player.h:284
const struct player * player
struct clause_list * clauses
Definition diptreaty.h:84
bool accept1
Definition diptreaty.h:83
struct player * plr0
Definition diptreaty.h:82
bool accept0
Definition diptreaty.h:83
struct tile * tile
Definition unit.h:141
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
const struct player_list * team_members(const struct team *pteam)
Definition team.c:443
struct advance * advance_by_number(const Tech_type_id atype)
Definition tech.c:110
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:305
const char * advance_rule_name(const struct advance *padvance)
Definition tech.c:314
void found_new_tech(struct research *presearch, Tech_type_id tech_found, bool was_discovery, bool saving_bulbs)
Definition techtools.c:347
void research_apply_penalty(struct research *presearch, Tech_type_id tech, int penalty_percent)
Definition techtools.c:67
void send_research_info(const struct research *presearch, const struct conn_list *dest)
Definition techtools.c:293
void script_tech_learned(struct research *presearch, struct player *originating_plr, struct advance *tech, const char *reason)
Definition techtools.c:84
bool tech_transfer(struct player *plr_recv, struct player *plr_donor, Tech_type_id tech)
Definition techtools.c:1512
struct unit_list * get_units_seen_via_ally(const struct player *pplayer, const struct player *aplayer)
Definition unittools.c:1429
void give_allied_visibility(struct player *pplayer, struct player *aplayer)
Definition unittools.c:1488