Freeciv-3.1: /fast/freeciv/nightly/S3_1/server/diplhand.c Source File

Freeciv-3.1

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 static struct treaty_list *treaties = NULL;
59
60/* FIXME: Should this be put in a ruleset somewhere? */
61#define TURNS_LEFT 16
62
63/**********************************************************************/
66 static void call_treaty_evaluate(struct player *pplayer, struct player *aplayer,
67 struct Treaty *ptreaty)
68{
69 if (is_ai(pplayer)) {
70 CALL_PLR_AI_FUNC(treaty_evaluate, pplayer, pplayer, aplayer, ptreaty);
71 }
72}
73
74/**********************************************************************/
77 static void call_treaty_accepted(struct player *pplayer, struct player *aplayer,
78 struct Treaty *ptreaty)
79{
80 if (is_ai(pplayer)) {
81 CALL_PLR_AI_FUNC(treaty_accepted, pplayer, pplayer, aplayer, ptreaty);
82 }
83}
84
85/**********************************************************************/
88 void diplhand_init(void)
89{
90 treaties = treaty_list_new();
91}
92
93/**********************************************************************/
96 void diplhand_free(void)
97{
98 free_treaties();
99
100 treaty_list_destroy(treaties);
101 treaties = NULL;
102}
103
104/**********************************************************************/
107 void free_treaties(void)
108{
109 /* Free memory allocated for treaties */
110 treaty_list_iterate(treaties, pt) {
111 clear_treaty(pt);
112 free(pt);
113 } treaty_list_iterate_end;
114
115 treaty_list_clear(treaties);
116}
117
118/**********************************************************************/
121 struct Treaty *find_treaty(struct player *plr0, struct player *plr1)
122{
123 treaty_list_iterate(treaties, ptreaty) {
124 if ((ptreaty->plr0 == plr0 && ptreaty->plr1 == plr1)
125 || (ptreaty->plr0 == plr1 && ptreaty->plr1 == plr0)) {
126 return ptreaty;
127 }
128 } treaty_list_iterate_end;
129
130 return NULL;
131}
132
133/**********************************************************************/
136 static enum diplstate_type dst_closest(enum diplstate_type a,
137 enum diplstate_type b)
138{
139 static const int how_close[DS_LAST] = {
140 [DS_NO_CONTACT] = 0,
141 [DS_WAR] = 1,
142 [DS_CEASEFIRE] = 2,
143 [DS_ARMISTICE] = 3,
144 [DS_PEACE] = 4,
145 [DS_ALLIANCE] = 5,
146 [DS_TEAM] = 6,
147 };
148
149 if (how_close[a] < how_close[b]) {
150 return b;
151 } else {
152 return a;
153 }
154}
155
156/**********************************************************************/
159 void set_diplstate_type(struct player_diplstate *state1,
160 struct player_diplstate *state2,
161 enum diplstate_type type)
162{
163 enum diplstate_type max;
164
165 if (type == DS_ARMISTICE) {
166 max = DS_PEACE;
167 } else {
168 max = type;
169 }
170
171 max = dst_closest(max, state1->max_state);
172
173 state1->type = type;
174 state2->type = type;
175 state1->max_state = max;
176 state2->max_state = max;
177}
178
179/**********************************************************************/
184 void handle_diplomacy_accept_treaty_req(struct player *pplayer,
185 int counterpart)
186{
187 struct Treaty *ptreaty;
188 bool *player_accept, *other_accept;
189 enum dipl_reason diplcheck;
190 bool worker_refresh_required = FALSE;
191 struct player *pother = player_by_number(counterpart);
192
193 const struct req_context player_ctxt = { .player = pplayer };
194 const struct req_context other_ctxt = { .player = pother };
195
196 if (NULL == pother || pplayer == pother) {
197 return;
198 }
199
200 ptreaty = find_treaty(pplayer, pother);
201
202 if (!ptreaty) {
203 return;
204 }
205
206 if (ptreaty->plr0 == pplayer) {
207 player_accept = &ptreaty->accept0;
208 other_accept = &ptreaty->accept1;
209 } else {
210 player_accept = &ptreaty->accept1;
211 other_accept = &ptreaty->accept0;
212 }
213
214 if (!*player_accept) { /* Tries to accept. */
215
216 /* Check that player who accepts can keep what they promise. */
217
218 clause_list_iterate(ptreaty->clauses, pclause) {
219 struct city *pcity = NULL;
220
221 if (pclause->from == pplayer) {
222 struct clause_info *info = clause_info_get(pclause->type);
223
224 if (!are_reqs_active(&player_ctxt, pother,
225 &(info->giver_reqs), RPT_POSSIBLE)
226 || !are_reqs_active(&other_ctxt, pplayer,
227 &(info->receiver_reqs), RPT_POSSIBLE)) {
228 log_error("Requirements of a clause between %s and %s not fulfilled",
229 player_name(pplayer), player_name(pother));
230 return;
231 }
232 }
233
234 if (pclause->from == pplayer || is_pact_clause(pclause->type)) {
235 switch (pclause->type) {
236 case CLAUSE_EMBASSY:
237 if (player_has_real_embassy(pother, pplayer)) {
238 log_error("%s tried to give embassy to %s, who already "
239 "has an embassy",
240 player_name(pplayer), player_name(pother));
241 return;
242 }
243 break;
244 case CLAUSE_ADVANCE:
245 if (!research_invention_gettable(research_get(pother),
246 pclause->value, game.info.tech_trade_allow_holes)) {
247 /* It is impossible to give a technology to a civilization that
248 * can not possess it (the client should enforce this). */
249 log_error("Treaty: %s can't have tech %s",
250 nation_rule_name(nation_of_player(pother)),
251 advance_rule_name(advance_by_number(pclause->value)));
252 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
253 _("The %s can't accept %s."),
254 nation_plural_for_player(pother),
255 advance_name_translation(advance_by_number
256 (pclause->value)));
257 return;
258 }
259 if (research_invention_state(research_get(pplayer), pclause->value)
260 != TECH_KNOWN) {
261 log_error("Nation %s try to give unknown tech %s to nation %s.",
262 nation_rule_name(nation_of_player(pplayer)),
263 advance_rule_name(advance_by_number(pclause->value)),
264 nation_rule_name(nation_of_player(pother)));
265 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
266 _("You don't have tech %s, you can't accept treaty."),
267 advance_name_translation(advance_by_number
268 (pclause->value)));
269 return;
270 }
271 break;
272 case CLAUSE_CITY:
273 pcity = game_city_by_number(pclause->value);
274 if (!pcity) { /* Can't find out cityname any more. */
275 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
276 _("City you are trying to give no longer exists, "
277 "you can't accept treaty."));
278 return;
279 }
280 if (city_owner(pcity) != pplayer) {
281 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
282 _("You are not owner of %s, you can't accept treaty."),
283 city_link(pcity));
284 return;
285 }
286 if (is_capital(pcity)) {
287 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
288 _("Your capital (%s) is requested, "
289 "you can't accept treaty."),
290 city_link(pcity));
291 return;
292 }
293 break;
294 case CLAUSE_CEASEFIRE:
295 diplcheck = pplayer_can_make_treaty(pplayer, pother, DS_CEASEFIRE);
296 if (diplcheck != DIPL_OK) {
297 return;
298 }
299 break;
300 case CLAUSE_PEACE:
301 diplcheck = pplayer_can_make_treaty(pplayer, pother, DS_PEACE);
302 if (diplcheck != DIPL_OK) {
303 return;
304 }
305 break;
306 case CLAUSE_ALLIANCE:
307 diplcheck = pplayer_can_make_treaty(pplayer, pother, DS_ALLIANCE);
308 if (diplcheck == DIPL_ALLIANCE_PROBLEM_US) {
309 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
310 _("You cannot form an alliance because you are "
311 "at war with an ally of %s."),
312 player_name(pother));
313 } else if (diplcheck == DIPL_ALLIANCE_PROBLEM_THEM) {
314 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
315 _("You cannot form an alliance because %s is "
316 "at war with an ally of yours."),
317 player_name(pother));
318 }
319 if (diplcheck != DIPL_OK) {
320 return;
321 }
322 break;
323 case CLAUSE_GOLD:
324 if (pplayer->economic.gold < pclause->value) {
325 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
326 _("You don't have enough gold, "
327 "you can't accept treaty."));
328 return;
329 }
330 break;
331 default:
332 ; /* nothing */
333 }
334 }
335 } clause_list_iterate_end;
336 }
337
338 *player_accept = ! *player_accept;
339
340 dlsend_packet_diplomacy_accept_treaty(pplayer->connections,
341 player_number(pother), *player_accept,
342 *other_accept);
343 dlsend_packet_diplomacy_accept_treaty(pother->connections,
344 player_number(pplayer), *other_accept,
345 *player_accept);
346
347 if (ptreaty->accept0 && ptreaty->accept1) {
348 int nclauses = clause_list_size(ptreaty->clauses);
349
350 dlsend_packet_diplomacy_cancel_meeting(pplayer->connections,
351 player_number(pother),
352 player_number(pplayer));
353 dlsend_packet_diplomacy_cancel_meeting(pother->connections,
354 player_number(pplayer),
355 player_number(pplayer));
356
357 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
358 PL_("A treaty containing %d clause was agreed upon.",
359 "A treaty containing %d clauses was agreed upon.",
360 nclauses),
361 nclauses);
362 notify_player(pother, NULL, E_DIPLOMACY, ftc_server,
363 PL_("A treaty containing %d clause was agreed upon.",
364 "A treaty containing %d clauses was agreed upon.",
365 nclauses),
366 nclauses);
367
368 /* Check that one who accepted treaty earlier still have everything
369 they promised to give. */
370
371 clause_list_iterate(ptreaty->clauses, pclause) {
372 struct city *pcity;
373
374 if (pclause->from == pother) {
375 struct clause_info *info = clause_info_get(pclause->type);
376
377 if (!are_reqs_active(&other_ctxt, pplayer,
378 &(info->giver_reqs), RPT_POSSIBLE)
379 || !are_reqs_active(&player_ctxt, pother,
380 &(info->receiver_reqs), RPT_POSSIBLE)) {
381 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
382 _("Clause requirements are no longer fulfilled. "
383 "Treaty with %s canceled!"),
384 nation_plural_for_player(pother));
385 notify_player(pother, NULL, E_DIPLOMACY, ftc_server,
386 _("Clause requirements are no longer fulfilled. "
387 "Treaty with %s canceled!"),
388 nation_plural_for_player(pplayer));
389 return;
390 }
391 }
392
393 if (pclause->from == pother) {
394 switch (pclause->type) {
395 case CLAUSE_CITY:
396 pcity = game_city_by_number(pclause->value);
397 if (!pcity) { /* Can't find out cityname any more. */
398 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
399 _("One of the cities the %s are giving away"
400 " is destroyed! Treaty canceled!"),
401 nation_plural_for_player(pother));
402 notify_player(pother, NULL, E_DIPLOMACY, ftc_server,
403 _("One of the cities the %s are giving away"
404 " is destroyed! Treaty canceled!"),
405 nation_plural_for_player(pother));
406 goto cleanup;
407 }
408 if (city_owner(pcity) != pother) {
409 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
410 _("The %s no longer control %s! "
411 "Treaty canceled!"),
412 nation_plural_for_player(pother),
413 city_link(pcity));
414 notify_player(pother, NULL, E_DIPLOMACY, ftc_server,
415 _("The %s no longer control %s! "
416 "Treaty canceled!"),
417 nation_plural_for_player(pother),
418 city_link(pcity));
419 goto cleanup;
420 }
421 if (is_capital(pcity)) {
422 notify_player(pother, NULL, E_DIPLOMACY, ftc_server,
423 _("Your capital (%s) is requested, "
424 "you can't accept treaty."),
425 city_link(pcity));
426 goto cleanup;
427 }
428
429 break;
430 case CLAUSE_ALLIANCE:
431 /* We need to recheck this way since things might have
432 * changed. */
433 diplcheck = pplayer_can_make_treaty(pplayer, pother, DS_ALLIANCE);
434 if (diplcheck != DIPL_OK) {
435 goto cleanup;
436 }
437 break;
438 case CLAUSE_PEACE:
439 diplcheck = pplayer_can_make_treaty(pplayer, pother, DS_PEACE);
440 if (diplcheck != DIPL_OK) {
441 goto cleanup;
442 }
443 break;
444 case CLAUSE_CEASEFIRE:
445 diplcheck = pplayer_can_make_treaty(pplayer, pother, DS_CEASEFIRE);
446 if (diplcheck != DIPL_OK) {
447 goto cleanup;
448 }
449 break;
450 case CLAUSE_GOLD:
451 if (pother->economic.gold < pclause->value) {
452 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
453 _("The %s don't have the promised amount "
454 "of gold! Treaty canceled!"),
455 nation_plural_for_player(pother));
456 notify_player(pother, NULL, E_DIPLOMACY, ftc_server,
457 _("The %s don't have the promised amount "
458 "of gold! Treaty canceled!"),
459 nation_plural_for_player(pother));
460 goto cleanup;
461 }
462 break;
463 default:
464 ; /* nothing */
465 }
466 }
467 } clause_list_iterate_end;
468
469 call_treaty_accepted(pplayer, pother, ptreaty);
470 call_treaty_accepted(pother, pplayer, ptreaty);
471
472 clause_list_iterate(ptreaty->clauses, pclause) {
473 struct player *pgiver = pclause->from;
474 struct player *pdest = (pplayer == pgiver) ? pother : pplayer;
475 struct player_diplstate *ds_giverdest
476 = player_diplstate_get(pgiver, pdest);
477 struct player_diplstate *ds_destgiver
478 = player_diplstate_get(pdest, pgiver);
479 enum diplstate_type old_diplstate = ds_giverdest->type;
480 struct unit_list *pgiver_seen_units BAD_HEURISTIC_INIT(NULL);
481 struct unit_list *pdest_seen_units BAD_HEURISTIC_INIT(NULL);
482
483 switch (pclause->type) {
484 case CLAUSE_EMBASSY:
485 establish_embassy(pdest, pgiver); /* sic */
486 notify_player(pgiver, NULL, E_TREATY_EMBASSY, ftc_server,
487 _("You gave an embassy to %s."),
488 player_name(pdest));
489 notify_player(pdest, NULL, E_TREATY_EMBASSY, ftc_server,
490 _("%s allowed you to create an embassy!"),
491 player_name(pgiver));
492 break;
493 case CLAUSE_ADVANCE:
494 {
495 /* It is possible that two players open the diplomacy dialog
496 * and try to give us the same tech at the same time. This
497 * should be handled discreetly instead of giving a core dump. */
498 struct research *presearch = research_get(pdest);
499 const char *advance_name;
500
501 if (research_invention_state(presearch, pclause->value)
502 == TECH_KNOWN) {
503 log_verbose("Nation %s already know tech %s, "
504 "that %s want to give them.",
505 nation_rule_name(nation_of_player(pdest)),
506 advance_rule_name(advance_by_number(pclause->value)),
507 nation_rule_name(nation_of_player(pgiver)));
508 break;
509 }
510 advance_name = advance_name_translation(advance_by_number
511 (pclause->value));
512 notify_player(pdest, NULL, E_TECH_GAIN, ftc_server,
513 _("You are taught the knowledge of %s."),
514 advance_name);
515
516 if (tech_transfer(pdest, pgiver, pclause->value)) {
517 char research_name[MAX_LEN_NAME * 2];
518
519 research_pretty_name(presearch, research_name,
520 sizeof(research_name));
521 notify_research(presearch, pdest, E_TECH_GAIN, ftc_server,
522 _("You have acquired %s thanks to the %s "
523 "treaty with the %s."),
524 advance_name,
525 nation_adjective_for_player(pdest),
526 nation_plural_for_player(pgiver));
527 notify_research_embassies
528 (presearch, pgiver, E_TECH_EMBASSY, ftc_server,
529 /* TRANS: Tech from another player */
530 Q_("?fromplr:The %s have acquired %s from the %s."),
531 research_name,
532 advance_name,
533 nation_plural_for_player(pgiver));
534
535 script_tech_learned(presearch, pdest,
536 advance_by_number(pclause->value), "traded");
537 research_apply_penalty(presearch, pclause->value,
538 game.server.diplbulbcost);
539 found_new_tech(presearch, pclause->value, FALSE, TRUE);
540 }
541 }
542 break;
543 case CLAUSE_GOLD:
544 {
545 int received = pclause->value
546 * (100 - game.server.diplgoldcost) / 100;
547 pgiver->economic.gold -= pclause->value;
548 pdest->economic.gold += received;
549 notify_player(pdest, NULL, E_DIPLOMACY, ftc_server,
550 PL_("You get %d gold.",
551 "You get %d gold.", received), received);
552 }
553 break;
554 case CLAUSE_MAP:
555 give_map_from_player_to_player(pgiver, pdest);
556 notify_player(pdest, NULL, E_DIPLOMACY, ftc_server,
557 /* TRANS: ... Polish worldmap. */
558 _("You receive the %s worldmap."),
559 nation_adjective_for_player(pgiver));
560
561 worker_refresh_required = TRUE; /* See CLAUSE_VISION */
562 break;
563 case CLAUSE_SEAMAP:
564 give_seamap_from_player_to_player(pgiver, pdest);
565 notify_player(pdest, NULL, E_DIPLOMACY, ftc_server,
566 /* TRANS: ... Polish seamap. */
567 _("You receive the %s seamap."),
568 nation_adjective_for_player(pgiver));
569
570 worker_refresh_required = TRUE; /* See CLAUSE_VISION */
571 break;
572 case CLAUSE_CITY:
573 {
574 struct city *pcity = game_city_by_number(pclause->value);
575
576 if (!pcity) {
577 log_error("Treaty city id %d not found - skipping clause.",
578 pclause->value);
579 break;
580 }
581
582 notify_player(pdest, city_tile(pcity), E_CITY_TRANSFER, ftc_server,
583 _("You receive the city of %s from %s."),
584 city_link(pcity), player_name(pgiver));
585
586 notify_player(pgiver, city_tile(pcity), E_CITY_LOST, ftc_server,
587 _("You give the city of %s to %s."),
588 city_link(pcity), player_name(pdest));
589
590 if (transfer_city(pdest, pcity, -1, TRUE, TRUE, FALSE,
591 !is_barbarian(pdest))) {
592 script_server_signal_emit("city_transferred", pcity, pgiver,
593 pdest, "trade");
594 }
595 break;
596 }
597 case CLAUSE_CEASEFIRE:
598 if (old_diplstate == DS_ALLIANCE) {
599 pgiver_seen_units = get_units_seen_via_ally(pgiver, pdest);
600 pdest_seen_units = get_units_seen_via_ally(pdest, pgiver);
601 }
602 ds_giverdest->type = DS_CEASEFIRE;
603 ds_giverdest->turns_left = TURNS_LEFT;
604 ds_destgiver->type = DS_CEASEFIRE;
605 ds_destgiver->turns_left = TURNS_LEFT;
606 notify_player(pgiver, NULL, E_TREATY_CEASEFIRE, ftc_server,
607 _("You agree on a cease-fire with %s."),
608 player_name(pdest));
609 notify_player(pdest, NULL, E_TREATY_CEASEFIRE, ftc_server,
610 _("You agree on a cease-fire with %s."),
611 player_name(pgiver));
612 if (old_diplstate == DS_ALLIANCE) {
613 update_players_after_alliance_breakup(pgiver, pdest,
614 pgiver_seen_units,
615 pdest_seen_units);
616 unit_list_destroy(pgiver_seen_units);
617 unit_list_destroy(pdest_seen_units);
618 }
619
620 worker_refresh_required = TRUE;
621 break;
622 case CLAUSE_PEACE:
623 if (old_diplstate == DS_ALLIANCE) {
624 pgiver_seen_units = get_units_seen_via_ally(pgiver, pdest);
625 pdest_seen_units = get_units_seen_via_ally(pdest, pgiver);
626 }
627 set_diplstate_type(ds_giverdest, ds_destgiver, DS_ARMISTICE);
628 ds_giverdest->turns_left = TURNS_LEFT;
629 ds_destgiver->turns_left = TURNS_LEFT;
630 notify_player(pgiver, NULL, E_TREATY_PEACE, ftc_server,
631 /* TRANS: ... the Poles ... Polish territory */
632 PL_("You agree on an armistice with the %s. In %d turn, "
633 "it will become a peace treaty. Move your "
634 "military units out of %s territory to avoid them "
635 "being disbanded.",
636 "You agree on an armistice with the %s. In %d turns, "
637 "it will become a peace treaty. Move any "
638 "military units out of %s territory to avoid them "
639 "being disbanded.",
640 TURNS_LEFT),
641 nation_plural_for_player(pdest),
642 TURNS_LEFT,
643 nation_adjective_for_player(pdest));
644 notify_player(pdest, NULL, E_TREATY_PEACE, ftc_server,
645 /* TRANS: ... the Poles ... Polish territory */
646 PL_("You agree on an armistice with the %s. In %d turn, "
647 "it will become a peace treaty. Move your "
648 "military units out of %s territory to avoid them "
649 "being disbanded.",
650 "You agree on an armistice with the %s. In %d turns, "
651 "it will become a peace treaty. Move any "
652 "military units out of %s territory to avoid them "
653 "being disbanded.",
654 TURNS_LEFT),
655 nation_plural_for_player(pgiver),
656 TURNS_LEFT,
657 nation_adjective_for_player(pgiver));
658 if (old_diplstate == DS_ALLIANCE) {
659 update_players_after_alliance_breakup(pgiver, pdest,
660 pgiver_seen_units,
661 pdest_seen_units);
662 unit_list_destroy(pgiver_seen_units);
663 unit_list_destroy(pdest_seen_units);
664 }
665
666 worker_refresh_required = TRUE;
667 break;
668 case CLAUSE_ALLIANCE:
669 set_diplstate_type(ds_giverdest, ds_destgiver, DS_ALLIANCE);
670 notify_player(pgiver, NULL, E_TREATY_ALLIANCE, ftc_server,
671 _("You agree on an alliance with %s."),
672 player_name(pdest));
673 notify_player(pdest, NULL, E_TREATY_ALLIANCE, ftc_server,
674 _("You agree on an alliance with %s."),
675 player_name(pgiver));
676 give_allied_visibility(pgiver, pdest);
677 give_allied_visibility(pdest, pgiver);
678
679 worker_refresh_required = TRUE;
680 break;
681 case CLAUSE_VISION:
682 give_shared_vision(pgiver, pdest);
683 notify_player(pgiver, NULL, E_TREATY_SHARED_VISION, ftc_server,
684 _("You give shared vision to %s."),
685 player_name(pdest));
686 notify_player(pdest, NULL, E_TREATY_SHARED_VISION, ftc_server,
687 _("%s gives you shared vision."),
688 player_name(pgiver));
689
690 /* Yes, shared vision may let us to _know_ tiles
691 * within radius of our own city. */
692 worker_refresh_required = TRUE;
693 break;
694 case CLAUSE_COUNT:
695 fc_assert(pclause->type != CLAUSE_COUNT);
696 break;
697 }
698
699 } clause_list_iterate_end;
700
701 /* In theory, we would need refresh only receiving party of
702 * CLAUSE_MAP, CLAUSE_SEAMAP and CLAUSE_VISION clauses.
703 * It's quite unlikely that there is such a clause going one
704 * way but no clauses affecting both parties or going other
705 * way. */
706 if (worker_refresh_required) {
707 city_map_update_all_cities_for_player(pplayer);
708 city_map_update_all_cities_for_player(pother);
709 sync_cities();
710 }
711
712 cleanup:
713 treaty_list_remove(treaties, ptreaty);
714 clear_treaty(ptreaty);
715 free(ptreaty);
716 send_player_all_c(pplayer, NULL);
717 send_player_all_c(pother, NULL);
718 }
719}
720
721/**********************************************************************/
724 void establish_embassy(struct player *pplayer, struct player *aplayer)
725{
726 /* Establish the embassy. */
727 BV_SET(pplayer->real_embassy, player_index(aplayer));
728
729 player_list_iterate(team_members(pplayer->team), teammate) {
730 /* Knowledge that pplayer has an embassy now */
731 send_player_all_c(pplayer, teammate->connections);
732 /* INFO_EMBASSY level info */
733 send_player_all_c(aplayer, teammate->connections);
734 } player_list_iterate_end;
735
736 /* update player dialog with embassy */
737 send_player_all_c(pplayer, aplayer->connections);
738
739 /* Send research info */
740 send_research_info(research_get(aplayer), pplayer->connections);
741}
742
743/**********************************************************************/
746 void handle_diplomacy_remove_clause_req(struct player *pplayer,
747 int counterpart, int giver,
748 enum clause_type type, int value)
749{
750 struct Treaty *ptreaty;
751 struct player *pgiver = player_by_number(giver);
752 struct player *pother = player_by_number(counterpart);
753
754 if (NULL == pother || pplayer == pother || NULL == pgiver) {
755 return;
756 }
757
758 if (pgiver != pplayer && pgiver != pother) {
759 return;
760 }
761
762 ptreaty = find_treaty(pplayer, pother);
763
764 if (ptreaty && remove_clause(ptreaty, pgiver, type, value)) {
765 dlsend_packet_diplomacy_remove_clause(pplayer->connections,
766 player_number(pother), giver, type,
767 value);
768 dlsend_packet_diplomacy_remove_clause(pother->connections,
769 player_number(pplayer), giver, type,
770 value);
771 call_treaty_evaluate(pplayer, pother, ptreaty);
772 call_treaty_evaluate(pother, pplayer, ptreaty);
773 }
774}
775
776/**********************************************************************/
779 void handle_diplomacy_create_clause_req(struct player *pplayer,
780 int counterpart, int giver,
781 enum clause_type type, int value)
782{
783 struct Treaty *ptreaty;
784 struct player *pgiver = player_by_number(giver);
785 struct player *pother = player_by_number(counterpart);
786
787 if (NULL == pother || pplayer == pother || NULL == pgiver) {
788 return;
789 }
790
791 if (pgiver != pplayer && pgiver != pother) {
792 return;
793 }
794
795 ptreaty = find_treaty(pplayer, pother);
796
797 if (ptreaty != NULL
798 && add_clause(ptreaty, pgiver, type, value, NULL)) {
799 /*
800 * If we are trading cities, then it is possible that
801 * the dest is unaware of it's existence. We have 2 choices,
802 * forbid it, or lighten that area. If we assume that
803 * the giver knows what they are doing, then 2. is the
804 * most powerful option - I'll choose that for now.
805 * - Kris Bubendorfer
806 */
807 if (type == CLAUSE_CITY) {
808 struct city *pcity = game_city_by_number(value);
809
810 if (pcity && !map_is_known_and_seen(pcity->tile, pother, V_MAIN))
811 give_citymap_from_player_to_player(pcity, pplayer, pother);
812 }
813
814 dlsend_packet_diplomacy_create_clause(pplayer->connections,
815 player_number(pother), giver, type,
816 value);
817 dlsend_packet_diplomacy_create_clause(pother->connections,
818 player_number(pplayer), giver, type,
819 value);
820 call_treaty_evaluate(pplayer, pother, ptreaty);
821 call_treaty_evaluate(pother, pplayer, ptreaty);
822 }
823}
824
825/**********************************************************************/
829 static void really_diplomacy_cancel_meeting(struct player *pplayer,
830 struct player *pother)
831{
832 struct Treaty *ptreaty = find_treaty(pplayer, pother);
833
834 if (ptreaty) {
835 dlsend_packet_diplomacy_cancel_meeting(pother->connections,
836 player_number(pplayer),
837 player_number(pplayer));
838 notify_player(pother, NULL, E_DIPLOMACY, ftc_server,
839 _("%s canceled the meeting!"),
840 player_name(pplayer));
841 /* Need to send to pplayer too, for multi-connects: */
842 dlsend_packet_diplomacy_cancel_meeting(pplayer->connections,
843 player_number(pother),
844 player_number(pplayer));
845 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
846 _("Meeting with %s canceled."),
847 player_name(pother));
848 treaty_list_remove(treaties, ptreaty);
849 clear_treaty(ptreaty);
850 free(ptreaty);
851 }
852}
853
854/**********************************************************************/
857 void handle_diplomacy_cancel_meeting_req(struct player *pplayer,
858 int counterpart)
859{
860 struct player *pother = player_by_number(counterpart);
861
862 if (NULL == pother || pplayer == pother) {
863 return;
864 }
865
866 really_diplomacy_cancel_meeting(pplayer, pother);
867}
868
869/**********************************************************************/
872 void handle_diplomacy_init_meeting_req(struct player *pplayer,
873 int counterpart)
874{
875 struct player *pother = player_by_number(counterpart);
876
877 if (NULL == pother || pplayer == pother) {
878 return;
879 }
880
881 if (find_treaty(pplayer, pother)) {
882 return;
883 }
884
885 if (get_player_bonus(pplayer, EFT_NO_DIPLOMACY) > 0
886 || get_player_bonus(pother, EFT_NO_DIPLOMACY) > 0) {
887 notify_player(pplayer, NULL, E_DIPLOMACY, ftc_server,
888 _("Your diplomatic envoy was decapitated!"));
889 return;
890 }
891
892 if (could_meet_with_player(pplayer, pother)) {
893 struct Treaty *ptreaty;
894
895 ptreaty = fc_malloc(sizeof(*ptreaty));
896 init_treaty(ptreaty, pplayer, pother);
897 treaty_list_prepend(treaties, ptreaty);
898
899 dlsend_packet_diplomacy_init_meeting(pplayer->connections,
900 player_number(pother),
901 player_number(pplayer));
902 dlsend_packet_diplomacy_init_meeting(pother->connections,
903 player_number(pplayer),
904 player_number(pplayer));
905 }
906}
907
908/**********************************************************************/
912 void send_diplomatic_meetings(struct connection *dest)
913{
914 struct player *pplayer = dest->playing;
915
916 if (!pplayer) {
917 return;
918 }
919 players_iterate(other) {
920 struct Treaty *ptreaty = find_treaty(pplayer, other);
921
922 if (ptreaty) {
923 fc_assert_action(pplayer != other, continue);
924 dsend_packet_diplomacy_init_meeting(dest, player_number(other),
925 player_number(pplayer));
926 clause_list_iterate(ptreaty->clauses, pclause) {
927 dsend_packet_diplomacy_create_clause(dest,
928 player_number(other),
929 player_number(pclause->from),
930 pclause->type,
931 pclause->value);
932 } clause_list_iterate_end;
933
934 if (ptreaty->plr0 == pplayer) {
935 dsend_packet_diplomacy_accept_treaty(dest, player_number(other),
936 ptreaty->accept0,
937 ptreaty->accept1);
938 } else {
939 dsend_packet_diplomacy_accept_treaty(dest, player_number(other),
940 ptreaty->accept1,
941 ptreaty->accept0);
942 }
943 }
944 } players_iterate_end;
945}
946
947/**********************************************************************/
950 void cancel_all_meetings(struct player *pplayer)
951{
952 players_iterate(pplayer2) {
953 if (find_treaty(pplayer, pplayer2)) {
954 really_diplomacy_cancel_meeting(pplayer, pplayer2);
955 }
956 } players_iterate_end;
957}
958
959/**********************************************************************/
962 void reject_all_treaties(struct player *pplayer)
963{
964 struct Treaty* treaty;
965 players_iterate(pplayer2) {
966 treaty = find_treaty(pplayer, pplayer2);
967 if (!treaty) {
968 continue;
969 }
970 treaty->accept0 = FALSE;
971 treaty->accept1 = FALSE;
972 dlsend_packet_diplomacy_accept_treaty(pplayer->connections,
973 player_number(pplayer2),
974 FALSE,
975 FALSE);
976 dlsend_packet_diplomacy_accept_treaty(pplayer2->connections,
977 player_number(pplayer),
978 FALSE,
979 FALSE);
980 } players_iterate_end;
981}
982
983/**********************************************************************/
986 struct treaty_list *get_all_treaties(void)
987{
988 return treaties;
989}
ai.h
CALL_PLR_AI_FUNC
#define CALL_PLR_AI_FUNC(_func, _player,...)
Definition ai.h:374
autosettlers.h
bitvector.h
BV_SET
#define BV_SET(bv, bit)
Definition bitvector.h:81
is_capital
bool is_capital(const struct city *pcity)
Definition city.c:1548
city_tile
#define city_tile(_pcity_)
Definition city.h:544
city_owner
#define city_owner(_pcity_)
Definition city.h:543
sync_cities
void sync_cities(void)
Definition citytools.c:3231
city_map_update_all_cities_for_player
void city_map_update_all_cities_for_player(struct player *pplayer)
Definition citytools.c:3265
transfer_city
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:1065
citytools.h
cityturn.h
diplhand_free
void diplhand_free(void)
Definition diplhand.c:96
treaties
static struct treaty_list * treaties
Definition diplhand.c:58
establish_embassy
void establish_embassy(struct player *pplayer, struct player *aplayer)
Definition diplhand.c:724
send_diplomatic_meetings
void send_diplomatic_meetings(struct connection *dest)
Definition diplhand.c:912
diplhand_init
void diplhand_init(void)
Definition diplhand.c:88
handle_diplomacy_remove_clause_req
void handle_diplomacy_remove_clause_req(struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
Definition diplhand.c:746
get_all_treaties
struct treaty_list * get_all_treaties(void)
Definition diplhand.c:986
handle_diplomacy_create_clause_req
void handle_diplomacy_create_clause_req(struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
Definition diplhand.c:779
free_treaties
void free_treaties(void)
Definition diplhand.c:107
call_treaty_accepted
static void call_treaty_accepted(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition diplhand.c:77
reject_all_treaties
void reject_all_treaties(struct player *pplayer)
Definition diplhand.c:962
set_diplstate_type
void set_diplstate_type(struct player_diplstate *state1, struct player_diplstate *state2, enum diplstate_type type)
Definition diplhand.c:159
handle_diplomacy_init_meeting_req
void handle_diplomacy_init_meeting_req(struct player *pplayer, int counterpart)
Definition diplhand.c:872
cancel_all_meetings
void cancel_all_meetings(struct player *pplayer)
Definition diplhand.c:950
handle_diplomacy_cancel_meeting_req
void handle_diplomacy_cancel_meeting_req(struct player *pplayer, int counterpart)
Definition diplhand.c:857
call_treaty_evaluate
static void call_treaty_evaluate(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition diplhand.c:66
TURNS_LEFT
#define TURNS_LEFT
Definition diplhand.c:61
dst_closest
static enum diplstate_type dst_closest(enum diplstate_type a, enum diplstate_type b)
Definition diplhand.c:136
find_treaty
struct Treaty * find_treaty(struct player *plr0, struct player *plr1)
Definition diplhand.c:121
really_diplomacy_cancel_meeting
static void really_diplomacy_cancel_meeting(struct player *pplayer, struct player *pother)
Definition diplhand.c:829
handle_diplomacy_accept_treaty_req
void handle_diplomacy_accept_treaty_req(struct player *pplayer, int counterpart)
Definition diplhand.c:184
diplhand.h
treaty_list_iterate
#define treaty_list_iterate(list, p)
Definition diplhand.h:30
treaty_list_iterate_end
#define treaty_list_iterate_end
Definition diplhand.h:32
giver
int int initiated_from int int giver
Definition diplodlg_g.h:28
counterpart
int counterpart
Definition diplodlg_g.h:25
clear_treaty
void clear_treaty(struct Treaty *ptreaty)
Definition diptreaty.c:109
init_treaty
void init_treaty(struct Treaty *ptreaty, struct player *plr0, struct player *plr1)
Definition diptreaty.c:96
add_clause
bool add_clause(struct Treaty *ptreaty, struct player *pfrom, enum clause_type type, int val, struct player *client_player)
Definition diptreaty.c:142
remove_clause
bool remove_clause(struct Treaty *ptreaty, struct player *pfrom, enum clause_type type, int val)
Definition diptreaty.c:120
clause_info_get
struct clause_info * clause_info_get(enum clause_type type)
Definition diptreaty.c:273
could_meet_with_player
bool could_meet_with_player(const struct player *pplayer, const struct player *aplayer)
Definition diptreaty.c:61
diptreaty.h
clause_list_iterate_end
#define clause_list_iterate_end
Definition diptreaty.h:68
clause_list_iterate
#define clause_list_iterate(clauselist, pclause)
Definition diptreaty.h:66
is_pact_clause
#define is_pact_clause(x)
Definition diptreaty.h:49
get_player_bonus
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Definition effects.c:771
events.h
RPT_POSSIBLE
@ RPT_POSSIBLE
Definition fc_types.h:585
MAX_LEN_NAME
#define MAX_LEN_NAME
Definition fc_types.h:66
fcintl.h
Q_
#define Q_(String)
Definition fcintl.h:70
PL_
#define PL_(String1, String2, n)
Definition fcintl.h:71
_
#define _(String)
Definition fcintl.h:67
ftc_server
const struct ft_color ftc_server
Definition featured_text.c:77
city_link
const char * city_link(const struct city *pcity)
Definition featured_text.c:1072
game
struct civ_game game
Definition game.c:57
game_city_by_number
struct city * game_city_by_number(int id)
Definition game.c:102
game.h
type
GType type
Definition repodlgs.c:1312
log.h
log_verbose
#define log_verbose(message,...)
Definition log.h:109
fc_assert
#define fc_assert(condition)
Definition log.h:176
fc_assert_action
#define fc_assert_action(condition, action)
Definition log.h:187
log_error
#define log_error(message,...)
Definition log.h:103
luascript_types.h
map.h
give_map_from_player_to_player
void give_map_from_player_to_player(struct player *pfrom, struct player *pdest)
Definition maphand.c:381
give_seamap_from_player_to_player
void give_seamap_from_player_to_player(struct player *pfrom, struct player *pdest)
Definition maphand.c:397
give_citymap_from_player_to_player
void give_citymap_from_player_to_player(struct city *pcity, struct player *pfrom, struct player *pdest)
Definition maphand.c:415
map_is_known_and_seen
bool map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
Definition maphand.c:900
give_shared_vision
void give_shared_vision(struct player *pfrom, struct player *pto)
Definition maphand.c:1620
maphand.h
mem.h
fc_malloc
#define fc_malloc(sz)
Definition mem.h:34
nation_rule_name
const char * nation_rule_name(const struct nation_type *pnation)
Definition nation.c:137
nation_adjective_for_player
const char * nation_adjective_for_player(const struct player *pplayer)
Definition nation.c:168
nation_of_player
struct nation_type * nation_of_player(const struct player *pplayer)
Definition nation.c:443
nation_plural_for_player
const char * nation_plural_for_player(const struct player *pplayer)
Definition nation.c:177
notify_research
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:394
notify_player
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:292
notify_research_embassies
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:434
notify.h
packets.h
dlsend_packet_diplomacy_init_meeting
void dlsend_packet_diplomacy_init_meeting(struct conn_list *dest, int counterpart, int initiated_from)
Definition packets_gen.c:48479
dlsend_packet_diplomacy_remove_clause
void dlsend_packet_diplomacy_remove_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
Definition packets_gen.c:49966
dsend_packet_diplomacy_create_clause
int dsend_packet_diplomacy_create_clause(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
Definition packets_gen.c:49397
dsend_packet_diplomacy_init_meeting
int dsend_packet_diplomacy_init_meeting(struct connection *pc, int counterpart, int initiated_from)
Definition packets_gen.c:48469
dlsend_packet_diplomacy_create_clause
void dlsend_packet_diplomacy_create_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
Definition packets_gen.c:49409
dlsend_packet_diplomacy_accept_treaty
void dlsend_packet_diplomacy_accept_treaty(struct conn_list *dest, int counterpart, bool I_accepted, bool other_accepted)
Definition packets_gen.c:50345
dlsend_packet_diplomacy_cancel_meeting
void dlsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, int counterpart, int initiated_from)
Definition packets_gen.c:48854
dsend_packet_diplomacy_accept_treaty
int dsend_packet_diplomacy_accept_treaty(struct connection *pc, int counterpart, bool I_accepted, bool other_accepted)
Definition packets_gen.c:50334
player_by_number
struct player * player_by_number(const int player_id)
Definition player.c:840
player_number
int player_number(const struct player *pplayer)
Definition player.c:828
pplayer_can_make_treaty
enum dipl_reason pplayer_can_make_treaty(const struct player *p1, const struct player *p2, enum diplstate_type treaty)
Definition player.c:153
player_name
const char * player_name(const struct player *pplayer)
Definition player.c:886
player_has_real_embassy
bool player_has_real_embassy(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:234
player_index
int player_index(const struct player *pplayer)
Definition player.c:820
player_diplstate_get
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:317
player.h
players_iterate_end
#define players_iterate_end
Definition player.h:535
dipl_reason
dipl_reason
Definition player.h:194
DIPL_ALLIANCE_PROBLEM_THEM
@ DIPL_ALLIANCE_PROBLEM_THEM
Definition player.h:196
DIPL_ALLIANCE_PROBLEM_US
@ DIPL_ALLIANCE_PROBLEM_US
Definition player.h:196
DIPL_OK
@ DIPL_OK
Definition player.h:195
players_iterate
#define players_iterate(_pplayer)
Definition player.h:530
player_list_iterate
#define player_list_iterate(playerlist, pplayer)
Definition player.h:553
is_barbarian
static bool is_barbarian(const struct player *pplayer)
Definition player.h:488
is_ai
#define is_ai(plr)
Definition player.h:234
player_list_iterate_end
#define player_list_iterate_end
Definition player.h:555
send_player_all_c
void send_player_all_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:983
update_players_after_alliance_breakup
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:685
plrhand.h
are_reqs_active
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)
Definition requirements.c:4361
research_get
struct research * research_get(const struct player *pplayer)
Definition research.c:126
research_invention_state
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Definition research.c:616
research_invention_gettable
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
Definition research.c:690
research_pretty_name
int research_pretty_name(const struct research *presearch, char *buf, size_t buf_len)
Definition research.c:167
research.h
script_server_signal_emit
void script_server_signal_emit(const char *signal_name,...)
Definition script_server.c:408
script_server.h
BAD_HEURISTIC_INIT
#define BAD_HEURISTIC_INIT(_ini_val_)
Definition shared.h:41
Treaty
Definition diptreaty.h:76
Treaty::plr0
struct player * plr0
Definition diptreaty.h:77
Treaty::accept0
bool accept0
Definition diptreaty.h:78
Treaty::accept1
bool accept1
Definition diptreaty.h:78
Treaty::clauses
struct clause_list * clauses
Definition diptreaty.h:79
Treaty::plr1
struct player * plr1
Definition diptreaty.h:77
city
Definition city.h:309
city::tile
struct tile * tile
Definition city.h:311
civ_game::diplgoldcost
int diplgoldcost
Definition game.h:139
civ_game::server
struct civ_game::@30::@34 server
civ_game::info
struct packet_game_info info
Definition game.h:89
civ_game::diplbulbcost
int diplbulbcost
Definition game.h:138
clause_info
Definition diptreaty.h:53
clause_info::receiver_reqs
struct requirement_vector receiver_reqs
Definition diptreaty.h:57
clause_info::giver_reqs
struct requirement_vector giver_reqs
Definition diptreaty.h:56
connection
Definition connection.h:141
connection::playing
struct player * playing
Definition connection.h:156
packet_game_info::tech_trade_allow_holes
bool tech_trade_allow_holes
Definition packets_gen.h:212
player_diplstate
Definition player.h:200
player_diplstate::turns_left
char turns_left
Definition player.h:204
player_diplstate::max_state
enum diplstate_type max_state
Definition player.h:202
player_diplstate::type
enum diplstate_type type
Definition player.h:201
player_economic::gold
int gold
Definition player.h:70
player
Definition player.h:249
player::team
struct team * team
Definition player.h:261
player::connections
struct conn_list * connections
Definition player.h:298
player::real_embassy
bv_player real_embassy
Definition player.h:277
player::economic
struct player_economic economic
Definition player.h:284
req_context
Definition requirements.h:99
req_context::player
const struct player * player
Definition requirements.h:100
research
Definition research.h:39
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
team_members
const struct player_list * team_members(const struct team *pteam)
Definition team.c:456
advance_by_number
struct advance * advance_by_number(const Tech_type_id atype)
Definition tech.c:107
advance_name_translation
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:290
advance_rule_name
const char * advance_rule_name(const struct advance *padvance)
Definition tech.c:299
found_new_tech
void found_new_tech(struct research *presearch, Tech_type_id tech_found, bool was_discovery, bool saving_bulbs)
Definition techtools.c:327
research_apply_penalty
void research_apply_penalty(struct research *presearch, Tech_type_id tech, int penalty_percent)
Definition techtools.c:67
send_research_info
void send_research_info(const struct research *presearch, const struct conn_list *dest)
Definition techtools.c:273
script_tech_learned
void script_tech_learned(struct research *presearch, struct player *originating_plr, struct advance *tech, const char *reason)
Definition techtools.c:84
tech_transfer
bool tech_transfer(struct player *plr_recv, struct player *plr_donor, Tech_type_id tech)
Definition techtools.c:1410
techtools.h
unit.h
get_units_seen_via_ally
struct unit_list * get_units_seen_via_ally(const struct player *pplayer, const struct player *aplayer)
Definition unittools.c:1433
give_allied_visibility
void give_allied_visibility(struct player *pplayer, struct player *aplayer)
Definition unittools.c:1492
unittools.h