Freeciv-3.2
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/advisors */
51#include "autosettlers.h"
52
53/* server/scripting */
54#include "script_server.h"
55
56#include "diplhand.h"
57
58
59/* FIXME: Should this be put in a ruleset somewhere? */
60#define TURNS_LEFT 16
61
62/**********************************************************************/
65static void call_treaty_evaluate(struct player *pplayer, struct player *aplayer,
66 struct Treaty *ptreaty)
67{
68 if (is_ai(pplayer)) {
69 CALL_PLR_AI_FUNC(treaty_evaluate, pplayer, pplayer, aplayer, ptreaty);
70 }
71}
72
73/**********************************************************************/
76static void call_treaty_accepted(struct player *pplayer, struct player *aplayer,
77 struct Treaty *ptreaty)
78{
79 if (is_ai(pplayer)) {
80 CALL_PLR_AI_FUNC(treaty_accepted, pplayer, pplayer, aplayer, ptreaty);
81 }
82}
83
84/**********************************************************************/
88 enum diplstate_type b)
89{
90 static const int how_close[DS_LAST] = {
91 [DS_NO_CONTACT] = 0,
92 [DS_WAR] = 1,
93 [DS_CEASEFIRE] = 2,
94 [DS_ARMISTICE] = 3,
95 [DS_PEACE] = 4,
96 [DS_ALLIANCE] = 5,
97 [DS_TEAM] = 6,
98 };
99
100 if (how_close[a] < how_close[b]) {
101 return b;
102 } else {
103 return a;
104 }
105}
106
107/**********************************************************************/
112{
113 if (dst_closest(dst->type, dst->max_state) == dst->max_state) {
114 /* Sane max_state */
115 return dst->max_state;
116 }
117
118 /* max_state illegally lower than current. Return current as max_state */
119 return dst->type;
120}
121
122/**********************************************************************/
126 struct player_diplstate *state2,
127 enum diplstate_type type)
128{
129 enum diplstate_type max;
130
131 if (type == DS_ARMISTICE) {
132 max = DS_PEACE;
133 } else {
134 max = type;
135 }
136
137 max = dst_closest(max, state1->max_state);
138
139 state1->type = type;
140 state2->type = type;
141 state1->max_state = max;
142 state2->max_state = max;
143}
144
145/**********************************************************************/
151 int counterpart)
152{
153 struct Treaty *ptreaty;
157 struct player *pother = player_by_number(counterpart);
158
159 const struct req_context player_ctxt = { .player = pplayer };
160 const struct req_context other_ctxt = { .player = pother };
161
162 if (NULL == pother || pplayer == pother) {
163 return;
164 }
165
166 ptreaty = find_treaty(pplayer, pother);
167
168 if (!ptreaty) {
169 return;
170 }
171
172 if (ptreaty->plr0 == pplayer) {
175 } else {
178 }
179
180 if (!*player_accept) { /* Tries to accept. */
181
182 /* Check that player who accepts can keep what they promise. */
183
185 struct city *pcity = NULL;
186
187 if (pclause->from == pplayer) {
188 struct clause_info *info = clause_info_get(pclause->type);
189
191 &(info->giver_reqs), RPT_POSSIBLE)
192 || !are_reqs_active(&other_ctxt, pplayer,
193 &(info->receiver_reqs), RPT_POSSIBLE)) {
194 log_error("Requirements of a clause between %s and %s not fulfilled",
195 player_name(pplayer), player_name(pother));
196 return;
197 }
198 }
199
200 if (pclause->from == pplayer || is_pact_clause(pclause->type)) {
201 switch (pclause->type) {
202 case CLAUSE_EMBASSY:
203 if (player_has_real_embassy(pother, pplayer)) {
204 log_error("%s tried to give embassy to %s, who already "
205 "has an embassy",
206 player_name(pplayer), player_name(pother));
207 return;
208 }
209 break;
210 case CLAUSE_ADVANCE:
213 /* It is impossible to give a technology to a civilization that
214 * can not possess it (the client should enforce this). */
215 log_error("Treaty: %s can't have tech %s",
219 _("The %s can't accept %s."),
222 (pclause->value)));
223 return;
224 }
225 if (research_invention_state(research_get(pplayer), pclause->value)
226 != TECH_KNOWN) {
227 log_error("Nation %s try to give unknown tech %s to nation %s.",
232 _("You don't have tech %s, you can't accept treaty."),
234 (pclause->value)));
235 return;
236 }
237 break;
238 case CLAUSE_CITY:
239 pcity = game_city_by_number(pclause->value);
240 if (!pcity) { /* Can't find out cityname any more. */
242 _("City you are trying to give no longer exists, "
243 "you can't accept treaty."));
244 return;
245 }
246 if (city_owner(pcity) != pplayer) {
248 _("You are not owner of %s, you can't accept treaty."),
249 city_link(pcity));
250 return;
251 }
252 if (is_capital(pcity)) {
254 _("Your capital (%s) is requested, "
255 "you can't accept treaty."),
256 city_link(pcity));
257 return;
258 }
259 break;
260 case CLAUSE_CEASEFIRE:
262 if (diplcheck != DIPL_OK) {
263 return;
264 }
265 break;
266 case CLAUSE_PEACE:
268 if (diplcheck != DIPL_OK) {
269 return;
270 }
271 break;
272 case CLAUSE_ALLIANCE:
276 _("You cannot form an alliance because you are "
277 "at war with an ally of %s."),
281 _("You cannot form an alliance because %s is "
282 "at war with an ally of yours."),
284 }
285 if (diplcheck != DIPL_OK) {
286 return;
287 }
288 break;
289 case CLAUSE_GOLD:
290 if (pplayer->economic.gold < pclause->value) {
292 _("You don't have enough gold, "
293 "you can't accept treaty."));
294 return;
295 }
296 break;
297 case CLAUSE_MAP:
298 case CLAUSE_SEAMAP:
299 case CLAUSE_VISION:
301 case CLAUSE_COUNT:
302 break;
303 }
304 }
306 }
307
309
312 *other_accept);
314 player_number(pplayer), *other_accept,
316
317 if (ptreaty->accept0 && ptreaty->accept1) {
319
322 player_number(pplayer));
324 player_number(pplayer),
325 player_number(pplayer));
326
328 PL_("A treaty containing %d clause was agreed upon.",
329 "A treaty containing %d clauses was agreed upon.",
330 nclauses),
331 nclauses);
333 PL_("A treaty containing %d clause was agreed upon.",
334 "A treaty containing %d clauses was agreed upon.",
335 nclauses),
336 nclauses);
337
338 /* Check that one who accepted treaty earlier still have everything
339 they promised to give. */
340
342 struct city *pcity;
343
344 if (pclause->from == pother) {
345 struct clause_info *info = clause_info_get(pclause->type);
346
347 if (!are_reqs_active(&other_ctxt, pplayer,
348 &(info->giver_reqs), RPT_POSSIBLE)
350 &(info->receiver_reqs), RPT_POSSIBLE)) {
352 _("Clause requirements are no longer fulfilled. "
353 "Treaty with %s canceled!"),
356 _("Clause requirements are no longer fulfilled. "
357 "Treaty with %s canceled!"),
358 nation_plural_for_player(pplayer));
359 return;
360 }
361 }
362
363 if (pclause->from == pother) {
364 switch (pclause->type) {
365 case CLAUSE_CITY:
366 pcity = game_city_by_number(pclause->value);
367 if (!pcity) { /* Can't find out cityname any more. */
369 _("One of the cities the %s are giving away"
370 " is destroyed! Treaty canceled!"),
373 _("One of the cities the %s are giving away"
374 " is destroyed! Treaty canceled!"),
376 goto cleanup;
377 }
378 if (city_owner(pcity) != pother) {
380 _("The %s no longer control %s! "
381 "Treaty canceled!"),
383 city_link(pcity));
385 _("The %s no longer control %s! "
386 "Treaty canceled!"),
388 city_link(pcity));
389 goto cleanup;
390 }
391 if (is_capital(pcity)) {
393 _("Your capital (%s) is requested, "
394 "you can't accept treaty."),
395 city_link(pcity));
396 goto cleanup;
397 }
398
399 break;
400 case CLAUSE_ALLIANCE:
401 /* We need to recheck this way since things might have
402 * changed. */
404 if (diplcheck != DIPL_OK) {
405 goto cleanup;
406 }
407 break;
408 case CLAUSE_PEACE:
410 if (diplcheck != DIPL_OK) {
411 goto cleanup;
412 }
413 break;
414 case CLAUSE_CEASEFIRE:
416 if (diplcheck != DIPL_OK) {
417 goto cleanup;
418 }
419 break;
420 case CLAUSE_GOLD:
421 if (pother->economic.gold < pclause->value) {
423 _("The %s don't have the promised amount "
424 "of gold! Treaty canceled!"),
427 _("The %s don't have the promised amount "
428 "of gold! Treaty canceled!"),
430 goto cleanup;
431 }
432 break;
433 default:
434 ; /* nothing */
435 }
436 }
438
441
443 struct player *pgiver = pclause->from;
444 struct player *pdest = (pplayer == pgiver) ? pother : pplayer;
450 struct unit_list *pgiver_seen_units BAD_HEURISTIC_INIT(NULL);
451 struct unit_list *pdest_seen_units BAD_HEURISTIC_INIT(NULL);
452
453 switch (pclause->type) {
454 case CLAUSE_EMBASSY:
455 establish_embassy(pdest, pgiver); /* sic */
457 _("You gave an embassy to %s."),
460 _("%s allowed you to create an embassy!"),
462 break;
463 case CLAUSE_ADVANCE:
464 {
465 /* It is possible that two players open the diplomacy dialog
466 * and try to give us the same tech at the same time. This
467 * should be handled discreetly instead of giving a core dump. */
469 const char *advance_name;
470
472 == TECH_KNOWN) {
473 log_verbose("Nation %s already know tech %s, "
474 "that %s want to give them.",
478 break;
479 }
481 (pclause->value));
483 _("You are taught the knowledge of %s."),
485
486 if (tech_transfer(pdest, pgiver, pclause->value)) {
487 char research_name[MAX_LEN_NAME * 2];
488
490 sizeof(research_name));
492 _("You have acquired %s thanks to the %s "
493 "treaty with the %s."),
499 /* TRANS: Tech from another player */
500 Q_("?fromplr:The %s have acquired %s from the %s."),
504
506 advance_by_number(pclause->value), "traded");
510 }
511 }
512 break;
513 case CLAUSE_GOLD:
514 {
515 int received = pclause->value
516 * (100 - game.server.diplgoldcost) / 100;
517 pgiver->economic.gold -= pclause->value;
518 pdest->economic.gold += received;
520 PL_("You get %d gold.",
521 "You get %d gold.", received), received);
522 }
523 break;
524 case CLAUSE_MAP:
527 /* TRANS: ... Polish worldmap. */
528 _("You receive the %s worldmap."),
530
531 worker_refresh_required = TRUE; /* See CLAUSE_VISION */
532 break;
533 case CLAUSE_SEAMAP:
536 /* TRANS: ... Polish seamap. */
537 _("You receive the %s seamap."),
539
540 worker_refresh_required = TRUE; /* See CLAUSE_VISION */
541 break;
542 case CLAUSE_CITY:
543 {
544 struct city *pcity = game_city_by_number(pclause->value);
545
546 if (!pcity) {
547 log_error("Treaty city id %d not found - skipping clause.",
548 pclause->value);
549 break;
550 }
551
553 _("You receive the city of %s from %s."),
554 city_link(pcity), player_name(pgiver));
555
557 _("You give the city of %s to %s."),
558 city_link(pcity), player_name(pdest));
559
560 if (transfer_city(pdest, pcity, -1, TRUE, TRUE, FALSE,
561 !is_barbarian(pdest))) {
562 script_server_signal_emit("city_transferred", pcity, pgiver,
563 pdest, "trade");
564 }
565 break;
566 }
567 case CLAUSE_CEASEFIRE:
568 if (old_diplstate == DS_ALLIANCE) {
571 }
573 ds_giverdest->turns_left = TURNS_LEFT;
574 ds_destgiver->turns_left = TURNS_LEFT;
576 _("You agree on a cease-fire with %s."),
579 _("You agree on a cease-fire with %s."),
581 if (old_diplstate == DS_ALLIANCE) {
587 }
588
590 break;
591 case CLAUSE_PEACE:
592 if (old_diplstate == DS_ALLIANCE) {
595 }
597 ds_giverdest->turns_left = TURNS_LEFT;
598 ds_destgiver->turns_left = TURNS_LEFT;
600 /* TRANS: ... the Poles ... Polish territory */
601 PL_("You agree on an armistice with the %s. In %d turn, "
602 "it will become a peace treaty. Move your "
603 "military units out of %s territory to avoid them "
604 "being disbanded.",
605 "You agree on an armistice with the %s. In %d turns, "
606 "it will become a peace treaty. Move any "
607 "military units out of %s territory to avoid them "
608 "being disbanded.",
609 TURNS_LEFT),
614 /* TRANS: ... the Poles ... Polish territory */
615 PL_("You agree on an armistice with the %s. In %d turn, "
616 "it will become a peace treaty. Move your "
617 "military units out of %s territory to avoid them "
618 "being disbanded.",
619 "You agree on an armistice with the %s. In %d turns, "
620 "it will become a peace treaty. Move any "
621 "military units out of %s territory to avoid them "
622 "being disbanded.",
623 TURNS_LEFT),
627 if (old_diplstate == DS_ALLIANCE) {
633 }
634
636 break;
637 case CLAUSE_ALLIANCE:
640 _("You agree on an alliance with %s."),
643 _("You agree on an alliance with %s."),
647
649 break;
650 case CLAUSE_VISION:
653 _("You give shared vision to %s."),
656 _("%s gives you shared vision."),
658
659 /* Yes, shared vision may let us to _know_ tiles
660 * within radius of our own city. */
662 break;
664 BV_SET(pgiver->gives_shared_tiles, player_index(pdest));
666 _("You share your tiles with %s."),
669 _("%s shares their tiles with you."),
672 break;
673 case CLAUSE_COUNT:
675 break;
676 }
677
679
680 /* In theory, we would need refresh only receiving party of
681 * CLAUSE_MAP, CLAUSE_SEAMAP and CLAUSE_VISION clauses.
682 * It's quite unlikely that there is such a clause going one
683 * way but no clauses affecting both parties or going other
684 * way. */
688 sync_cities();
689 }
690
691 cleanup:
693 send_player_all_c(pplayer, NULL);
695 }
696}
697
698/**********************************************************************/
701void establish_embassy(struct player *pplayer, struct player *aplayer)
702{
703 /* Establish the embassy. */
705
707 /* Knowledge that pplayer has an embassy now */
709 /* INFO_EMBASSY level info */
710 send_player_all_c(aplayer, teammate->connections);
712
713 /* update player dialog with embassy */
715
716 /* Send research info */
718}
719
720/**********************************************************************/
724 int counterpart, int giver,
725 enum clause_type type, int value)
726{
727 struct Treaty *ptreaty;
728 struct player *pgiver = player_by_number(giver);
729 struct player *pother = player_by_number(counterpart);
730
731 if (NULL == pother || pplayer == pother || NULL == pgiver) {
732 return;
733 }
734
735 if (pgiver != pplayer && pgiver != pother) {
736 return;
737 }
738
739 ptreaty = find_treaty(pplayer, pother);
740
741 if (ptreaty && remove_clause(ptreaty, pgiver, type, value)) {
743 player_number(pother), giver, type,
744 value);
746 player_number(pplayer), giver, type,
747 value);
750 }
751}
752
753/**********************************************************************/
757 int counterpart, int giver,
758 enum clause_type type, int value)
759{
760 struct Treaty *ptreaty;
761 struct player *pgiver = player_by_number(giver);
762 struct player *pother = player_by_number(counterpart);
763
764 if (NULL == pother || pplayer == pother || NULL == pgiver) {
765 return;
766 }
767
768 if (pgiver != pplayer && pgiver != pother) {
769 return;
770 }
771
772 ptreaty = find_treaty(pplayer, pother);
773
774 if (ptreaty != NULL
775 && add_clause(ptreaty, pgiver, type, value, NULL)) {
776 /*
777 * If we are trading cities, then it is possible that
778 * the dest is unaware of it's existence. We have 2 choices,
779 * forbid it, or lighten that area. If we assume that
780 * the giver knows what they are doing, then 2. is the
781 * most powerful option - I'll choose that for now.
782 * - Kris Bubendorfer
783 */
784 if (type == CLAUSE_CITY) {
785 struct city *pcity = game_city_by_number(value);
786
787 if (pcity && !map_is_known_and_seen(pcity->tile, pother, V_MAIN)) {
789 }
790 }
791
793 player_number(pother), giver, type,
794 value);
796 player_number(pplayer), giver, type,
797 value);
800 }
801}
802
803/**********************************************************************/
807static void really_diplomacy_cancel_meeting(struct player *pplayer,
808 struct player *pother)
809{
810 struct Treaty *ptreaty = find_treaty(pplayer, pother);
811
812 if (ptreaty) {
814 player_number(pplayer),
815 player_number(pplayer));
817 _("%s canceled the meeting!"),
818 player_name(pplayer));
819 /* Need to send to pplayer too, for multi-connects: */
822 player_number(pplayer));
824 _("Meeting with %s canceled."),
827 }
828}
829
830/**********************************************************************/
834 int counterpart)
835{
836 struct player *pother = player_by_number(counterpart);
837
838 if (NULL == pother || pplayer == pother) {
839 return;
840 }
841
843}
844
845/**********************************************************************/
849 int counterpart)
850{
851 struct player *pother = player_by_number(counterpart);
852
853 if (NULL == pother || pplayer == pother) {
854 return;
855 }
856
857 if (find_treaty(pplayer, pother)) {
858 return;
859 }
860
861 if (get_player_bonus(pplayer, EFT_NO_DIPLOMACY) > 0
864 _("Your diplomatic envoy was decapitated!"));
865 return;
866 }
867
868 if (could_meet_with_player(pplayer, pother)) {
869 struct Treaty *ptreaty;
870
871 ptreaty = fc_malloc(sizeof(*ptreaty));
872 init_treaty(ptreaty, pplayer, pother);
874
877 player_number(pplayer));
879 player_number(pplayer),
880 player_number(pplayer));
881 }
882}
883
884/**********************************************************************/
889{
890 struct player *pplayer = dest->playing;
891
892 if (!pplayer) {
893 return;
894 }
896 struct Treaty *ptreaty = find_treaty(pplayer, other);
897
898 if (ptreaty) {
899 fc_assert_action(pplayer != other, continue);
901 player_number(pplayer));
905 player_number(pclause->from),
906 pclause->type,
907 pclause->value);
909
910 if (ptreaty->plr0 == pplayer) {
914 } else {
918 }
919 }
921}
922
923/**********************************************************************/
926void cancel_all_meetings(struct player *pplayer)
927{
929 if (find_treaty(pplayer, pplayer2)) {
931 }
933}
934
935/**********************************************************************/
938void reject_all_treaties(struct player *pplayer)
939{
940 struct Treaty* treaty;
942 treaty = find_treaty(pplayer, pplayer2);
943 if (!treaty) {
944 continue;
945 }
946 treaty->accept0 = FALSE;
947 treaty->accept1 = FALSE;
950 FALSE,
951 FALSE);
953 player_number(pplayer),
954 FALSE,
955 FALSE);
957}
#define CALL_PLR_AI_FUNC(_func, _player,...)
Definition ai.h:377
#define BV_SET(bv, bit)
Definition bitvector.h:81
bool is_capital(const struct city *pcity)
Definition city.c:1579
#define city_tile(_pcity_)
Definition city.h:564
#define city_owner(_pcity_)
Definition city.h:563
void sync_cities(void)
Definition citytools.c:3342
void city_map_update_all_cities_for_player(struct player *pplayer)
Definition citytools.c:3376
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:1076
char * incite_cost
Definition comments.c:75
void establish_embassy(struct player *pplayer, struct player *aplayer)
Definition diplhand.c:701
void send_diplomatic_meetings(struct connection *dest)
Definition diplhand.c:888
void handle_diplomacy_remove_clause_req(struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
Definition diplhand.c:723
void handle_diplomacy_create_clause_req(struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
Definition diplhand.c:756
static void call_treaty_accepted(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition diplhand.c:76
void reject_all_treaties(struct player *pplayer)
Definition diplhand.c:938
enum diplstate_type valid_dst_closest(struct player_diplstate *dst)
Definition diplhand.c:111
void set_diplstate_type(struct player_diplstate *state1, struct player_diplstate *state2, enum diplstate_type type)
Definition diplhand.c:125
void handle_diplomacy_init_meeting_req(struct player *pplayer, int counterpart)
Definition diplhand.c:848
void cancel_all_meetings(struct player *pplayer)
Definition diplhand.c:926
void handle_diplomacy_cancel_meeting_req(struct player *pplayer, int counterpart)
Definition diplhand.c:833
static void call_treaty_evaluate(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition diplhand.c:65
#define TURNS_LEFT
Definition diplhand.c:60
static enum diplstate_type dst_closest(enum diplstate_type a, enum diplstate_type b)
Definition diplhand.c:87
static void really_diplomacy_cancel_meeting(struct player *pplayer, struct player *pother)
Definition diplhand.c:807
void handle_diplomacy_accept_treaty_req(struct player *pplayer, int counterpart)
Definition diplhand.c:150
struct Treaty * ptreaty
Definition diplodlg_g.h:28
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
void treaty_add(struct Treaty *ptreaty)
Definition diptreaty.c:361
bool remove_clause(struct Treaty *ptreaty, struct player *pfrom, enum clause_type type, int val)
Definition diptreaty.c:123
void treaty_remove(struct Treaty *ptreaty)
Definition diptreaty.c:369
struct Treaty * find_treaty(struct player *plr0, struct player *plr1)
Definition diptreaty.c:346
struct clause_info * clause_info_get(enum clause_type type)
Definition diptreaty.c:276
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:70
#define clause_list_iterate(clauselist, pclause)
Definition diptreaty.h:68
#define is_pact_clause(x)
Definition diptreaty.h:51
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Definition effects.c:828
@ RPT_POSSIBLE
Definition fc_types.h:700
#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:62
struct city * game_city_by_number(int id)
Definition game.c:107
GType type
Definition repodlgs.c:1313
#define log_verbose(message,...)
Definition log.h:109
#define fc_assert(condition)
Definition log.h:176
#define fc_assert_action(condition, action)
Definition log.h:187
#define log_error(message,...)
Definition log.h:103
void give_map_from_player_to_player(struct player *pfrom, struct player *pdest)
Definition maphand.c:384
void give_seamap_from_player_to_player(struct player *pfrom, struct player *pdest)
Definition maphand.c:400
void give_citymap_from_player_to_player(struct city *pcity, struct player *pfrom, struct player *pdest)
Definition maphand.c:418
bool map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
Definition maphand.c:920
void give_shared_vision(struct player *pfrom, struct player *pto)
Definition maphand.c:1632
#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:537
dipl_reason
Definition player.h:190
@ DIPL_ALLIANCE_PROBLEM_THEM
Definition player.h:192
@ DIPL_ALLIANCE_PROBLEM_US
Definition player.h:192
@ DIPL_OK
Definition player.h:191
#define players_iterate(_pplayer)
Definition player.h:532
#define player_list_iterate(playerlist, pplayer)
Definition player.h:555
static bool is_barbarian(const struct player *pplayer)
Definition player.h:489
#define is_ai(plr)
Definition player.h:230
#define player_list_iterate_end
Definition player.h:557
void send_player_all_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1129
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 player *other_player, 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
struct player * plr0
Definition diptreaty.h:79
bool accept0
Definition diptreaty.h:80
bool accept1
Definition diptreaty.h:80
struct clause_list * clauses
Definition diptreaty.h:81
Definition city.h:320
struct tile * tile
Definition city.h:322
int diplgoldcost
Definition game.h:144
struct packet_game_info info
Definition game.h:89
int diplbulbcost
Definition game.h:143
struct civ_game::@31::@35 server
struct requirement_vector receiver_reqs
Definition diptreaty.h:59
struct requirement_vector giver_reqs
Definition diptreaty.h:58
struct player * playing
Definition connection.h:151
bool tech_trade_allow_holes
enum diplstate_type max_state
Definition player.h:198
enum diplstate_type type
Definition player.h:197
struct team * team
Definition player.h:259
struct conn_list * connections
Definition player.h:296
bv_player real_embassy
Definition player.h:275
struct player_economic economic
Definition player.h:282
const struct player * player
#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:290
const char * advance_rule_name(const struct advance *padvance)
Definition tech.c:299
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:1409
void give_allied_visibility(struct player *pplayer, struct player *aplayer)
Definition unittools.c:1468