Freeciv-3.3
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
56/* FIXME: Should this be put in a ruleset somewhere? */
57#define TURNS_LEFT 16
58
59/**********************************************************************/
62static void call_treaty_evaluate(struct player *pplayer, struct player *aplayer,
63 struct treaty *ptreaty)
64{
65 if (is_ai(pplayer)) {
66 CALL_PLR_AI_FUNC(treaty_evaluate, pplayer, pplayer, aplayer, ptreaty);
67 }
68}
69
70/**********************************************************************/
73static void call_treaty_accepted(struct player *pplayer, struct player *aplayer,
74 struct treaty *ptreaty)
75{
76 if (is_ai(pplayer)) {
77 CALL_PLR_AI_FUNC(treaty_accepted, pplayer, pplayer, aplayer, ptreaty);
78 }
79}
80
81/**********************************************************************/
85 enum diplstate_type b)
86{
87 static const int how_close[DS_LAST] = {
88 [DS_NO_CONTACT] = 0,
89 [DS_WAR] = 1,
90 [DS_CEASEFIRE] = 2,
91 [DS_ARMISTICE] = 3,
92 [DS_PEACE] = 4,
93 [DS_ALLIANCE] = 5,
94 [DS_TEAM] = 6,
95 };
96
97 if (how_close[a] < how_close[b]) {
98 return b;
99 } else {
100 return a;
101 }
102}
103
104/**********************************************************************/
109{
110 if (dst_closest(dst->type, dst->max_state) == dst->max_state) {
111 /* Sane max_state */
112 return dst->max_state;
113 }
114
115 /* max_state illegally lower than current. Return current as max_state */
116 return dst->type;
117}
118
119/**********************************************************************/
123 struct player_diplstate *state2,
124 enum diplstate_type type)
125{
126 enum diplstate_type max;
127
128 if (type == DS_ARMISTICE) {
129 max = DS_PEACE;
130 } else {
131 max = type;
132 }
133
134 max = dst_closest(max, state1->max_state);
135
136 state1->type = type;
137 state2->type = type;
138 state1->max_state = max;
139 state2->max_state = max;
140}
141
142/**********************************************************************/
148 int counterpart)
149{
150 struct treaty *ptreaty;
154 struct player *pother = player_by_number(counterpart);
155
156 const struct req_context player_ctxt = { .player = pplayer };
157 const struct req_context other_ctxt = { .player = pother };
158
159 if (NULL == pother || pplayer == pother) {
160 return;
161 }
162
163 ptreaty = find_treaty(pplayer, pother);
164
165 if (!ptreaty) {
166 return;
167 }
168
169 if (ptreaty->plr0 == pplayer) {
172 } else {
175 }
176
177 if (!*player_accept) { /* Tries to accept. */
178
179 /* Check that player who accepts can keep what they promise. */
180
182 struct city *pcity = NULL;
183
184 if (pclause->from == pplayer) {
185 struct clause_info *info = clause_info_get(pclause->type);
186
188 &(info->giver_reqs), RPT_POSSIBLE)
190 &(info->receiver_reqs), RPT_POSSIBLE)) {
191 log_error("Requirements of a clause between %s and %s not fulfilled",
192 player_name(pplayer), player_name(pother));
193 return;
194 }
195 }
196
197 if (pclause->from == pplayer || is_pact_clause(pclause->type)) {
198 switch (pclause->type) {
199 case CLAUSE_EMBASSY:
200 if (player_has_real_embassy(pother, pplayer)) {
201 log_error("%s tried to give embassy to %s, who already "
202 "has an embassy",
203 player_name(pplayer), player_name(pother));
204 return;
205 }
206 break;
207 case CLAUSE_ADVANCE:
210 /* It is impossible to give a technology to a civilization that
211 * can not possess it (the client should enforce this). */
212 log_error("Treaty: %s can't have tech %s",
216 _("The %s can't accept %s."),
219 (pclause->value)));
220 return;
221 }
222 if (research_invention_state(research_get(pplayer), pclause->value)
223 != TECH_KNOWN) {
224 log_error("Nation %s try to give unknown tech %s to nation %s.",
229 _("You don't have tech %s, you can't accept treaty."),
231 (pclause->value)));
232 return;
233 }
234 break;
235 case CLAUSE_CITY:
237 if (!pcity) { /* Can't find out cityname any more. */
239 _("City you are trying to give no longer exists, "
240 "you can't accept treaty."));
241 return;
242 }
243 if (city_owner(pcity) != pplayer) {
245 _("You are not owner of %s, you can't accept treaty."),
247 return;
248 }
249 if (is_capital(pcity)) {
251 _("Your capital (%s) is requested, "
252 "you can't accept treaty."),
254 return;
255 }
256 break;
257 case CLAUSE_CEASEFIRE:
259 if (diplcheck != DIPL_OK) {
260 return;
261 }
262 break;
263 case CLAUSE_PEACE:
265 if (diplcheck != DIPL_OK) {
266 return;
267 }
268 break;
269 case CLAUSE_ALLIANCE:
273 _("You cannot form an alliance because you are "
274 "at war with an ally of %s."),
278 _("You cannot form an alliance because %s is "
279 "at war with an ally of yours."),
281 }
282 if (diplcheck != DIPL_OK) {
283 return;
284 }
285 break;
286 case CLAUSE_GOLD:
287 if (pplayer->economic.gold < pclause->value) {
289 _("You don't have enough gold, "
290 "you can't accept treaty."));
291 return;
292 }
293 break;
294 case CLAUSE_MAP:
295 case CLAUSE_SEAMAP:
296 case CLAUSE_VISION:
298 case CLAUSE_COUNT:
299 break;
300 }
301 }
303 }
304
306
309 *other_accept);
311 player_number(pplayer), *other_accept,
313
314 if (ptreaty->accept0 && ptreaty->accept1) {
316
319 player_number(pplayer));
321 player_number(pplayer),
322 player_number(pplayer));
323
325 PL_("A treaty containing %d clause was agreed upon.",
326 "A treaty containing %d clauses was agreed upon.",
327 nclauses),
328 nclauses);
330 PL_("A treaty containing %d clause was agreed upon.",
331 "A treaty containing %d clauses was agreed upon.",
332 nclauses),
333 nclauses);
334
335 /* Check that one who accepted treaty earlier still have everything
336 they promised to give. */
337
339 struct city *pcity;
340
341 if (pclause->from == pother) {
342 struct clause_info *info = clause_info_get(pclause->type);
343
345 &(info->giver_reqs), RPT_POSSIBLE)
347 &(info->receiver_reqs), RPT_POSSIBLE)) {
349 _("Clause requirements are no longer fulfilled. "
350 "Treaty with %s canceled!"),
353 _("Clause requirements are no longer fulfilled. "
354 "Treaty with %s canceled!"),
355 nation_plural_for_player(pplayer));
356 return;
357 }
358 }
359
360 if (pclause->from == pother) {
361 switch (pclause->type) {
362 case CLAUSE_CITY:
364 if (!pcity) { /* Can't find out cityname any more. */
366 _("One of the cities the %s are giving away"
367 " is destroyed! Treaty canceled!"),
370 _("One of the cities the %s are giving away"
371 " is destroyed! Treaty canceled!"),
373 goto cleanup;
374 }
375 if (city_owner(pcity) != pother) {
377 _("The %s no longer control %s! "
378 "Treaty canceled!"),
382 _("The %s no longer control %s! "
383 "Treaty canceled!"),
386 goto cleanup;
387 }
388 if (is_capital(pcity)) {
390 _("Your capital (%s) is requested, "
391 "you can't accept treaty."),
393 goto cleanup;
394 }
395
396 break;
397 case CLAUSE_ALLIANCE:
398 /* We need to recheck this way since things might have
399 * changed. */
401 if (diplcheck != DIPL_OK) {
402 goto cleanup;
403 }
404 break;
405 case CLAUSE_PEACE:
407 if (diplcheck != DIPL_OK) {
408 goto cleanup;
409 }
410 break;
411 case CLAUSE_CEASEFIRE:
413 if (diplcheck != DIPL_OK) {
414 goto cleanup;
415 }
416 break;
417 case CLAUSE_GOLD:
418 if (pother->economic.gold < pclause->value) {
420 _("The %s don't have the promised amount "
421 "of gold! Treaty canceled!"),
424 _("The %s don't have the promised amount "
425 "of gold! Treaty canceled!"),
427 goto cleanup;
428 }
429 break;
430 default:
431 ; /* nothing */
432 }
433 }
435
438
440 struct player *pgiver = pclause->from;
441 struct player *pdest = (pplayer == pgiver) ? pother : pplayer;
447 struct unit_list *pgiver_seen_units BAD_HEURISTIC_INIT(NULL);
448 struct unit_list *pdest_seen_units BAD_HEURISTIC_INIT(NULL);
449
450 switch (pclause->type) {
451 case CLAUSE_EMBASSY:
452 establish_embassy(pdest, pgiver); /* sic */
454 _("You gave an embassy to %s."),
457 _("%s allowed you to create an embassy!"),
459 break;
460 case CLAUSE_ADVANCE:
461 {
462 /* It is possible that two players open the diplomacy dialog
463 * and try to give us the same tech at the same time. This
464 * should be handled discreetly instead of giving a core dump. */
466 const char *advance_name;
467
469 == TECH_KNOWN) {
470 log_verbose("Nation %s already know tech %s, "
471 "that %s want to give them.",
475 break;
476 }
478 (pclause->value));
480 _("You are taught the knowledge of %s."),
482
483 if (tech_transfer(pdest, pgiver, pclause->value)) {
484 char research_name[MAX_LEN_NAME * 2];
485
487 sizeof(research_name));
489 _("You have acquired %s thanks to the %s "
490 "treaty with the %s."),
496 /* TRANS: Tech from another player */
497 Q_("?fromplr:The %s have acquired %s from the %s."),
501
503 advance_by_number(pclause->value), "traded");
507 }
508 }
509 break;
510 case CLAUSE_GOLD:
511 {
512 int received = pclause->value
513 * (100 - game.server.diplgoldcost) / 100;
514 pgiver->economic.gold -= pclause->value;
515 pdest->economic.gold += received;
517 PL_("You get %d gold.",
518 "You get %d gold.", received), received);
519 }
520 break;
521 case CLAUSE_MAP:
524 /* TRANS: ... Polish worldmap. */
525 _("You receive the %s worldmap."),
527
528 worker_refresh_required = TRUE; /* See CLAUSE_VISION */
529 break;
530 case CLAUSE_SEAMAP:
533 /* TRANS: ... Polish seamap. */
534 _("You receive the %s seamap."),
536
537 worker_refresh_required = TRUE; /* See CLAUSE_VISION */
538 break;
539 case CLAUSE_CITY:
540 {
541 struct city *pcity = game_city_by_number(pclause->value);
542
543 if (!pcity) {
544 log_error("Treaty city id %d not found - skipping clause.",
545 pclause->value);
546 break;
547 }
548
550 _("You receive the city of %s from %s."),
552
554 _("You give the city of %s to %s."),
556
558 !is_barbarian(pdest))) {
559 script_server_signal_emit("city_transferred", pcity, pgiver,
560 pdest, "trade");
561 }
562 break;
563 }
564 case CLAUSE_CEASEFIRE:
565 if (old_diplstate == DS_ALLIANCE) {
568 }
570 ds_giverdest->turns_left = TURNS_LEFT;
571 ds_destgiver->turns_left = TURNS_LEFT;
573 _("You agree on a cease-fire with %s."),
576 _("You agree on a cease-fire with %s."),
578 if (old_diplstate == DS_ALLIANCE) {
584 }
585
587 break;
588 case CLAUSE_PEACE:
589 if (old_diplstate == DS_ALLIANCE) {
592 }
594 ds_giverdest->turns_left = TURNS_LEFT;
595 ds_destgiver->turns_left = TURNS_LEFT;
597 /* TRANS: ... the Poles ... Polish territory */
598 PL_("You agree on an armistice with the %s. In %d turn, "
599 "it will become a peace treaty. Move your "
600 "military units out of %s territory to avoid them "
601 "being disbanded.",
602 "You agree on an armistice with the %s. In %d turns, "
603 "it will become a peace treaty. Move any "
604 "military units out of %s territory to avoid them "
605 "being disbanded.",
606 TURNS_LEFT),
611 /* TRANS: ... the Poles ... Polish territory */
612 PL_("You agree on an armistice with the %s. In %d turn, "
613 "it will become a peace treaty. Move your "
614 "military units out of %s territory to avoid them "
615 "being disbanded.",
616 "You agree on an armistice with the %s. In %d turns, "
617 "it will become a peace treaty. Move any "
618 "military units out of %s territory to avoid them "
619 "being disbanded.",
620 TURNS_LEFT),
624 if (old_diplstate == DS_ALLIANCE) {
630 }
631
633 break;
634 case CLAUSE_ALLIANCE:
637 _("You agree on an alliance with %s."),
640 _("You agree on an alliance with %s."),
644
646 break;
647 case CLAUSE_VISION:
650 _("You give shared vision to %s."),
653 _("%s gives you shared vision."),
655
656 /* Yes, shared vision may let us to _know_ tiles
657 * within radius of our own city. */
659 break;
661 BV_SET(pgiver->gives_shared_tiles, player_index(pdest));
663 _("You share your tiles with %s."),
666 _("%s shares their tiles with you."),
669 break;
670 case CLAUSE_COUNT:
672 break;
673 }
674
676
677 /* In theory, we would need refresh only receiving party of
678 * CLAUSE_MAP, CLAUSE_SEAMAP and CLAUSE_VISION clauses.
679 * It's quite unlikely that there is such a clause going one
680 * way but no clauses affecting both parties or going other
681 * way. */
685 sync_cities();
686 }
687
688 cleanup:
690 send_player_all_c(pplayer, NULL);
692 }
693}
694
695/**********************************************************************/
698void establish_embassy(struct player *pplayer, struct player *aplayer)
699{
700 /* Establish the embassy. */
702
704 /* Knowledge that pplayer has an embassy now */
706 /* INFO_EMBASSY level info */
707 send_player_all_c(aplayer, teammate->connections);
709
710 /* update player dialog with embassy */
712
713 /* Send research info */
715}
716
717/**********************************************************************/
721 int counterpart, int giver,
722 enum clause_type type, int value)
723{
724 struct treaty *ptreaty;
725 struct player *pgiver = player_by_number(giver);
726 struct player *pother = player_by_number(counterpart);
727
728 if (NULL == pother || pplayer == pother || NULL == pgiver) {
729 return;
730 }
731
732 if (pgiver != pplayer && pgiver != pother) {
733 return;
734 }
735
736 ptreaty = find_treaty(pplayer, pother);
737
738 if (ptreaty && remove_clause(ptreaty, pgiver, type, value)) {
740 player_number(pother), giver, type,
741 value);
743 player_number(pplayer), giver, type,
744 value);
747 }
748}
749
750/**********************************************************************/
754 int counterpart, int giver,
755 enum clause_type type, int value)
756{
757 struct treaty *ptreaty;
758 struct player *pgiver = player_by_number(giver);
759 struct player *pother = player_by_number(counterpart);
760
761 if (NULL == pother || pplayer == pother || NULL == pgiver) {
762 return;
763 }
764
765 if (pgiver != pplayer && pgiver != pother) {
766 return;
767 }
768
769 ptreaty = find_treaty(pplayer, pother);
770
771 if (ptreaty != NULL
772 && add_clause(ptreaty, pgiver, type, value, NULL)) {
773 /*
774 * If we are trading cities, then it is possible that
775 * the dest is unaware of it's existence. We have 2 choices,
776 * forbid it, or lighten that area. If we assume that
777 * the giver knows what they are doing, then 2. is the
778 * most powerful option - I'll choose that for now.
779 * - Kris Bubendorfer
780 */
781 if (type == CLAUSE_CITY) {
782 struct city *pcity = game_city_by_number(value);
783
786 }
787 }
788
790 player_number(pother), giver, type,
791 value);
793 player_number(pplayer), giver, type,
794 value);
797 }
798}
799
800/**********************************************************************/
804static void really_diplomacy_cancel_meeting(struct player *pplayer,
805 struct player *pother)
806{
807 struct treaty *ptreaty = find_treaty(pplayer, pother);
808
809 if (ptreaty) {
811 player_number(pplayer),
812 player_number(pplayer));
814 _("%s canceled the meeting!"),
815 player_name(pplayer));
816 /* Need to send to pplayer too, for multi-connects: */
819 player_number(pplayer));
821 _("Meeting with %s canceled."),
824 }
825}
826
827/**********************************************************************/
831 int counterpart)
832{
833 struct player *pother = player_by_number(counterpart);
834
835 if (NULL == pother || pplayer == pother) {
836 return;
837 }
838
840}
841
842/**********************************************************************/
846 int counterpart)
847{
848 struct player *pother = player_by_number(counterpart);
849
850 if (NULL == pother || pplayer == pother) {
851 return;
852 }
853
854 if (find_treaty(pplayer, pother)) {
855 return;
856 }
857
858 if (get_player_bonus(pplayer, EFT_NO_DIPLOMACY) > 0
861 _("Your diplomatic envoy was decapitated!"));
862 return;
863 }
864
865 if (could_meet_with_player(pplayer, pother)) {
866 struct treaty *ptreaty;
867
868 ptreaty = fc_malloc(sizeof(*ptreaty));
869 init_treaty(ptreaty, pplayer, pother);
871
874 player_number(pplayer));
876 player_number(pplayer),
877 player_number(pplayer));
878 }
879}
880
881/**********************************************************************/
886{
887 struct player *pplayer = dest->playing;
888
889 if (!pplayer) {
890 return;
891 }
893 struct treaty *ptreaty = find_treaty(pplayer, other);
894
895 if (ptreaty) {
896 fc_assert_action(pplayer != other, continue);
898 player_number(pplayer));
902 player_number(pclause->from),
903 pclause->type,
904 pclause->value);
906
907 if (ptreaty->plr0 == pplayer) {
911 } else {
915 }
916 }
918}
919
920/**********************************************************************/
923void cancel_all_meetings(struct player *pplayer)
924{
926 if (find_treaty(pplayer, pplayer2)) {
928 }
930}
931
932/**********************************************************************/
935void reject_all_treaties(struct player *pplayer)
936{
937 struct treaty *treaty;
938
940 treaty = find_treaty(pplayer, pplayer2);
941 if (treaty == nullptr) {
942 continue;
943 }
948 FALSE,
949 FALSE);
951 player_number(pplayer),
952 FALSE,
953 FALSE);
955}
#define CALL_PLR_AI_FUNC(_func, _player,...)
Definition ai.h:377
#define BV_SET(bv, bit)
Definition bitvector.h:89
bool is_capital(const struct city *pcity)
Definition city.c:1579
#define city_tile(_pcity_)
Definition city.h:561
#define city_owner(_pcity_)
Definition city.h:560
void sync_cities(void)
Definition citytools.c:3351
void city_map_update_all_cities_for_player(struct player *pplayer)
Definition citytools.c:3385
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:76
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:78
void establish_embassy(struct player *pplayer, struct player *aplayer)
Definition diplhand.c:698
void send_diplomatic_meetings(struct connection *dest)
Definition diplhand.c:885
static void call_treaty_accepted(struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
Definition diplhand.c:73
void handle_diplomacy_remove_clause_req(struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
Definition diplhand.c:720
void handle_diplomacy_create_clause_req(struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
Definition diplhand.c:753
void reject_all_treaties(struct player *pplayer)
Definition diplhand.c:935
enum diplstate_type valid_dst_closest(struct player_diplstate *dst)
Definition diplhand.c:108
static void call_treaty_evaluate(struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
Definition diplhand.c:62
void set_diplstate_type(struct player_diplstate *state1, struct player_diplstate *state2, enum diplstate_type type)
Definition diplhand.c:122
void handle_diplomacy_init_meeting_req(struct player *pplayer, int counterpart)
Definition diplhand.c:845
void cancel_all_meetings(struct player *pplayer)
Definition diplhand.c:923
void handle_diplomacy_cancel_meeting_req(struct player *pplayer, int counterpart)
Definition diplhand.c:830
#define TURNS_LEFT
Definition diplhand.c:57
static enum diplstate_type dst_closest(enum diplstate_type a, enum diplstate_type b)
Definition diplhand.c:84
static void really_diplomacy_cancel_meeting(struct player *pplayer, struct player *pother)
Definition diplhand.c:804
void handle_diplomacy_accept_treaty_req(struct player *pplayer, int counterpart)
Definition diplhand.c:147
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:532
#define MAX_LEN_NAME
Definition fc_types.h:66
#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:61
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 give_map_from_player_to_player(struct player *pfrom, struct player *pdest)
Definition maphand.c:382
void give_seamap_from_player_to_player(struct player *pfrom, struct player *pdest)
Definition maphand.c:398
void give_citymap_from_player_to_player(struct city *pcity, struct player *pfrom, struct player *pdest)
Definition maphand.c:416
bool map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
Definition maphand.c:925
void give_shared_vision(struct player *pfrom, struct player *pto)
Definition maphand.c:1637
#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:444
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
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)
struct player * player_by_number(const int player_id)
Definition player.c:849
int player_number(const struct player *pplayer)
Definition player.c:837
enum dipl_reason pplayer_can_make_treaty(const struct player *p1, const struct player *p2, enum diplstate_type treaty)
Definition player.c:159
const char * player_name(const struct player *pplayer)
Definition player.c:895
bool player_has_real_embassy(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:240
int player_index(const struct player *pplayer)
Definition player.c:829
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:324
#define players_iterate_end
Definition player.h:542
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:537
#define player_list_iterate(playerlist, pplayer)
Definition player.h:560
static bool is_barbarian(const struct player *pplayer)
Definition player.h:491
#define is_ai(plr)
Definition player.h:232
#define player_list_iterate_end
Definition player.h:562
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:128
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Definition research.c:619
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
Definition research.c:693
int research_pretty_name(const struct research *presearch, char *buf, size_t buf_len)
Definition research.c:169
void script_server_signal_emit(const char *signal_name,...)
#define BAD_HEURISTIC_INIT(_ini_val_)
Definition shared.h:41
Definition city.h:317
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:142
#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:456
struct advance * advance_by_number(const Tech_type_id atype)
Definition tech.c:107
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:300
const char * advance_rule_name(const struct advance *padvance)
Definition tech.c:309
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:1438
struct unit_list * get_units_seen_via_ally(const struct player *pplayer, const struct player *aplayer)
Definition unittools.c:1416
void give_allied_visibility(struct player *pplayer, struct player *aplayer)
Definition unittools.c:1475