Freeciv-3.1: /fast/freeciv/nightly/S3_1/common/metaknowledge.c Source File

Freeciv-3.1

Loading...
Searching...
No Matches
metaknowledge.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996-2013 - Freeciv Development Team
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/* common */
19#include "diptreaty.h"
20#include "game.h"
21#include "map.h"
22#include "metaknowledge.h"
23#include "tile.h"
24#include "traderoutes.h"
25
26/**********************************************************************/
30 static bool is_tile_seen_cadj(const struct player *pow_player,
31 const struct tile *target_tile)
32{
33 /* The tile it self is unseen. */
34 if (!tile_is_seen(target_tile, pow_player)) {
35 return FALSE;
36 }
37
38 /* A cardinally adjacent tile is unseen. */
39 cardinal_adjc_iterate(&(wld.map), target_tile, ptile) {
40 if (!tile_is_seen(ptile, pow_player)) {
41 return FALSE;
42 }
43 } cardinal_adjc_iterate_end;
44
45 /* They are all seen. */
46 return TRUE;
47}
48
49/**********************************************************************/
53 static bool is_tile_seen_adj(const struct player *pow_player,
54 const struct tile *target_tile)
55{
56 /* The tile it self is unseen. */
57 if (!tile_is_seen(target_tile, pow_player)) {
58 return FALSE;
59 }
60
61 /* An adjacent tile is unseen. */
62 adjc_iterate(&(wld.map), target_tile, ptile) {
63 if (!tile_is_seen(ptile, pow_player)) {
64 return FALSE;
65 }
66 } adjc_iterate_end;
67
68 /* They are all seen. */
69 return TRUE;
70}
71
72/**********************************************************************/
75 static bool is_tile_seen_city(const struct player *pow_player,
76 const struct city *target_city)
77{
78 const struct civ_map *nmap = &(wld.map);
79
80 /* Don't know the city radius. */
81 if (!can_player_see_city_internals(pow_player, target_city)) {
82 return FALSE;
83 }
84
85 /* A tile of the city is unseen */
86 city_tile_iterate(nmap, city_map_radius_sq_get(target_city),
87 city_tile(target_city), ptile) {
88 if (!tile_is_seen(ptile, pow_player)) {
89 return FALSE;
90 }
91 } city_tile_iterate_end;
92
93 /* They are all seen. */
94 return TRUE;
95}
96
97/**********************************************************************/
101 static bool is_tile_seen_trade_route(const struct player *pow_player,
102 const struct city *target_city)
103{
104 /* Don't know who the trade routes will go to. */
105 if (!can_player_see_city_internals(pow_player, target_city)) {
106 return FALSE;
107 }
108
109 /* A tile of the city is unseen */
110 if (!is_tile_seen_city(pow_player, target_city)) {
111 return FALSE;
112 }
113
114 /* A tile of a trade parter is unseen */
115 trade_partners_iterate(target_city, trade_partner) {
116 if (!is_tile_seen_city(pow_player, trade_partner)) {
117 return FALSE;
118 }
119 } trade_partners_iterate_end;
120
121 /* They are all seen. */
122 return TRUE;
123}
124
125/**********************************************************************/
129 static bool can_plr_see_all_sym_diplrels_of(const struct player *pplayer,
130 const struct player *tplayer)
131{
132 if (pplayer == tplayer) {
133 /* Can see own relationships. */
134 return TRUE;
135 }
136
137 if (team_has_embassy(pplayer->team, tplayer)) {
138 /* Gets reports from the embassy. */
139 return TRUE;
140 }
141
142 if (player_diplstate_get(pplayer, tplayer)->contact_turns_left > 0) {
143 /* Can see relationships during contact turns. */
144 return TRUE;
145 }
146
147 return FALSE;
148}
149
150/**********************************************************************/
160 static bool is_req_knowable(const struct player *pov_player,
161 const struct req_context *context,
162 const struct player *other_player,
163 const struct requirement *req,
164 const enum req_problem_type prob_type)
165{
166 fc_assert_ret_val_msg(NULL != pov_player, FALSE, "No point of view");
167
168 if (context == NULL) {
169 context = req_context_empty();
170 }
171
172 if (req->source.kind == VUT_UTFLAG
173 || req->source.kind == VUT_UTYPE
174 || req->source.kind == VUT_UCLASS
175 || req->source.kind == VUT_UCFLAG
176 || req->source.kind == VUT_MINVETERAN
177 || req->source.kind == VUT_MINHP) {
178 switch (req->range) {
179 case REQ_RANGE_LOCAL:
180 if (context->unit == NULL) {
181 /* The unit may exist but not be passed when the problem type is
182 * RPT_POSSIBLE. */
183 return prob_type == RPT_CERTAIN;
184 }
185
186 return can_player_see_unit(pov_player, context->unit);
187 case REQ_RANGE_CADJACENT:
188 case REQ_RANGE_ADJACENT:
189 case REQ_RANGE_CONTINENT:
190 case REQ_RANGE_CITY:
191 case REQ_RANGE_TRADE_ROUTE:
192 case REQ_RANGE_PLAYER:
193 case REQ_RANGE_TEAM:
194 case REQ_RANGE_ALLIANCE:
195 case REQ_RANGE_WORLD:
196 case REQ_RANGE_COUNT:
197 return FALSE;
198 }
199 }
200
201 if (req->source.kind == VUT_UNITSTATE) {
202 fc_assert_ret_val_msg(req->range == REQ_RANGE_LOCAL, FALSE, "Wrong range");
203
204 if (context->unit == NULL) {
205 /* The unit may exist but not be passed when the problem type is
206 * RPT_POSSIBLE. */
207 return prob_type == RPT_CERTAIN;
208 }
209
210 switch (req->source.value.unit_state) {
211 case USP_TRANSPORTED:
212 case USP_LIVABLE_TILE:
213 case USP_TRANSPORTING:
214 case USP_NATIVE_TILE:
215 case USP_NATIVE_EXTRA:
216 /* Known if the unit is seen by the player. */
217 return can_player_see_unit(pov_player, context->unit);
218 case USP_HAS_HOME_CITY:
219 case USP_MOVED_THIS_TURN:
220 /* Known to the unit's owner. */
221 return unit_owner(context->unit) == pov_player;
222 case USP_COUNT:
223 fc_assert_msg(req->source.value.unit_state != USP_COUNT,
224 "Invalid unit state property.");
225 /* Invalid property is unknowable. */
226 return FALSE;
227 }
228 }
229
230 if (req->source.kind == VUT_MINMOVES) {
231 fc_assert_ret_val_msg(req->range == REQ_RANGE_LOCAL, FALSE, "Wrong range");
232
233 if (context->unit == NULL) {
234 /* The unit may exist but not be passed when the problem type is
235 * RPT_POSSIBLE. */
236 return prob_type == RPT_CERTAIN;
237 }
238
239 switch (req->range) {
240 case REQ_RANGE_LOCAL:
241 /* The owner can see if their unit has move fragments left. */
242 return unit_owner(context->unit) == pov_player;
243 case REQ_RANGE_CADJACENT:
244 case REQ_RANGE_ADJACENT:
245 case REQ_RANGE_CITY:
246 case REQ_RANGE_TRADE_ROUTE:
247 case REQ_RANGE_CONTINENT:
248 case REQ_RANGE_PLAYER:
249 case REQ_RANGE_TEAM:
250 case REQ_RANGE_ALLIANCE:
251 case REQ_RANGE_WORLD:
252 case REQ_RANGE_COUNT:
253 /* Invalid range */
254 return FALSE;
255 }
256 }
257
258 if (req->source.kind == VUT_ACTIVITY) {
259 fc_assert_ret_val_msg(req->range == REQ_RANGE_LOCAL,
260 FALSE, "Wrong range");
261
262 if (context->unit == NULL) {
263 /* The unit may exist but not be passed when the problem type is
264 * RPT_POSSIBLE. */
265 return prob_type == RPT_CERTAIN;
266 }
267
268 if (unit_owner(context->unit) == pov_player) {
269 return TRUE;
270 }
271
272 /* Sent in package_short_unit() */
273 return can_player_see_unit(pov_player, context->unit);
274 }
275
276 if (req->source.kind == VUT_DIPLREL
277 || req->source.kind == VUT_DIPLREL_TILE
278 || req->source.kind == VUT_DIPLREL_TILE_O
279 || req->source.kind == VUT_DIPLREL_UNITANY
280 || req->source.kind == VUT_DIPLREL_UNITANY_O) {
281 switch (req->range) {
282 case REQ_RANGE_LOCAL:
283 if (other_player == NULL
284 || context->player == NULL) {
285 /* The two players may exist but not be passed when the problem
286 * type is RPT_POSSIBLE. */
287 return prob_type == RPT_CERTAIN;
288 }
289
290 if (pov_player == context->player
291 || pov_player == other_player) {
292 return TRUE;
293 }
294
295 if (can_plr_see_all_sym_diplrels_of(pov_player, context->player)
296 || can_plr_see_all_sym_diplrels_of(pov_player, other_player)) {
297 return TRUE;
298 }
299
300 /* TODO: Non symmetric diplomatic relationships. */
301 break;
302 case REQ_RANGE_PLAYER:
303 if (context->player == NULL) {
304 /* The target player may exist but not be passed when the problem
305 * type is RPT_POSSIBLE. */
306 return prob_type == RPT_CERTAIN;
307 }
308
309 if (pov_player == context->player) {
310 return TRUE;
311 }
312
313 if (can_plr_see_all_sym_diplrels_of(pov_player, context->player)) {
314 return TRUE;
315 }
316
317 /* TODO: Non symmetric diplomatic relationships. */
318 break;
319 case REQ_RANGE_TEAM:
320 /* TODO */
321 break;
322 case REQ_RANGE_ALLIANCE:
323 /* TODO */
324 break;
325 case REQ_RANGE_WORLD:
326 /* TODO */
327 break;
328 case REQ_RANGE_CADJACENT:
329 case REQ_RANGE_ADJACENT:
330 case REQ_RANGE_CITY:
331 case REQ_RANGE_TRADE_ROUTE:
332 case REQ_RANGE_CONTINENT:
333 case REQ_RANGE_COUNT:
334 /* Invalid range */
335 return FALSE;
336 break;
337 }
338 }
339
340 if (req->source.kind == VUT_MINSIZE) {
341 if (context->city == NULL) {
342 /* The city may exist but not be passed when the problem type is
343 * RPT_POSSIBLE. */
344 return prob_type == RPT_CERTAIN;
345 }
346
347 if (player_can_see_city_externals(pov_player, context->city)) {
348 return TRUE;
349 }
350 }
351
352 if (req->source.kind == VUT_CITYTILE) {
353 struct city *pcity;
354
355 if (context->tile == NULL) {
356 /* The tile may exist but not be passed when the problem type is
357 * RPT_POSSIBLE. */
358 return prob_type == RPT_CERTAIN;
359 }
360
361 switch (req->range) {
362 case REQ_RANGE_LOCAL:
363 /* Known because the tile is seen */
364 if (tile_is_seen(context->tile, pov_player)) {
365 return TRUE;
366 }
367
368 /* The player knows their city even if they can't see it */
369 pcity = tile_city(context->tile);
370 return pcity && city_owner(pcity) == pov_player;
371 case REQ_RANGE_CADJACENT:
372 /* Known because the tile is seen */
373 if (is_tile_seen_cadj(pov_player, context->tile)) {
374 return TRUE;
375 }
376
377 /* The player knows their city even if they can't see it */
378 cardinal_adjc_iterate(&(wld.map), context->tile, ptile) {
379 pcity = tile_city(ptile);
380 if (pcity && city_owner(pcity) == pov_player) {
381 return TRUE;
382 }
383 } cardinal_adjc_iterate_end;
384
385 /* Unknown */
386 return FALSE;
387 case REQ_RANGE_ADJACENT:
388 /* Known because the tile is seen */
389 if (is_tile_seen_adj(pov_player, context->tile)) {
390 return TRUE;
391 }
392
393 /* The player knows their city even if they can't see it */
394 adjc_iterate(&(wld.map), context->tile, ptile) {
395 pcity = tile_city(ptile);
396 if (pcity && city_owner(pcity) == pov_player) {
397 return TRUE;
398 }
399 } adjc_iterate_end;
400
401 /* Unknown */
402 return FALSE;
403 case REQ_RANGE_CITY:
404 case REQ_RANGE_TRADE_ROUTE:
405 case REQ_RANGE_CONTINENT:
406 case REQ_RANGE_PLAYER:
407 case REQ_RANGE_TEAM:
408 case REQ_RANGE_ALLIANCE:
409 case REQ_RANGE_WORLD:
410 case REQ_RANGE_COUNT:
411 /* Invalid range */
412 return FALSE;
413 }
414 }
415
416 if (req->source.kind == VUT_IMPR_GENUS) {
417 /* The only legal range when this was written was local. */
418 fc_assert(req->range == REQ_RANGE_LOCAL);
419
420 if (context->city == NULL) {
421 /* RPT_CERTAIN: Can't be. No city to contain it.
422 * RPT_POSSIBLE: A city like that may exist but not be passed. */
423 return prob_type == RPT_CERTAIN;
424 }
425
426 /* Local BuildingGenus could be about city production. */
427 return can_player_see_city_internals(pov_player, context->city);
428 }
429
430 if (req->source.kind == VUT_IMPROVEMENT) {
431 switch (req->range) {
432 case REQ_RANGE_WORLD:
433 case REQ_RANGE_ALLIANCE:
434 case REQ_RANGE_TEAM:
435 case REQ_RANGE_PLAYER:
436 case REQ_RANGE_CONTINENT:
437 /* Only wonders (great or small) can be required in those ranges.
438 * Wonders are always visible. */
439 return TRUE;
440 case REQ_RANGE_TRADE_ROUTE:
441 /* Could be known for trade routes to cities owned by pov_player as
442 * long as the requirement is present. Not present requirements would
443 * require knowledge that no trade routes to another foreign city
444 * exists (since all possible trade routes are to a city owned by
445 * pov_player). Not worth the complexity, IMHO. */
446 return FALSE;
447 case REQ_RANGE_CITY:
448 case REQ_RANGE_LOCAL:
449 if (context->city == NULL) {
450 /* RPT_CERTAIN: Can't be. No city to contain it.
451 * RPT_POSSIBLE: A city like that may exist but not be passed. */
452 return prob_type == RPT_CERTAIN;
453 }
454
455 if (can_player_see_city_internals(pov_player, context->city)) {
456 /* Anyone that can see city internals (like the owner) known all
457 * its improvements. */
458 return TRUE;
459 }
460
461 if (is_improvement_visible(req->source.value.building)
462 && player_can_see_city_externals(pov_player, context->city)) {
463 /* Can see visible improvements when the outside of the city is
464 * seen. */
465 return TRUE;
466 }
467
468 /* No way to know if a city has an improvement */
469 return FALSE;
470 case REQ_RANGE_CADJACENT:
471 case REQ_RANGE_ADJACENT:
472 case REQ_RANGE_COUNT:
473 /* Not supported by the requirement type. */
474 return FALSE;
475 }
476 }
477
478 if (req->source.kind == VUT_NATION
479 || req->source.kind == VUT_NATIONGROUP) {
480 if (context->player == NULL
481 && (req->range == REQ_RANGE_PLAYER
482 || req->range == REQ_RANGE_TEAM
483 || req->range == REQ_RANGE_ALLIANCE)) {
484 /* The player (that can have a nationality or be allied to someone
485 * with the nationality) may exist but not be passed when the problem
486 * type is RPT_POSSIBLE. */
487 return prob_type == RPT_CERTAIN;
488 }
489
490 return TRUE;
491 }
492
493 if (req->source.kind == VUT_ADVANCE || req->source.kind == VUT_TECHFLAG) {
494 if (req->range == REQ_RANGE_PLAYER) {
495 if (context->player == NULL) {
496 /* The player (that may or may not possess the tech) may exist but
497 * not be passed when the problem type is RPT_POSSIBLE. */
498 return prob_type == RPT_CERTAIN;
499 }
500
501 return can_see_techs_of_target(pov_player, context->player);
502 } else if (req->range == REQ_RANGE_WORLD && req->survives) {
503 /* game.info.global_advances is sent to each player */
504 return TRUE;
505 }
506 }
507
508 if (req->source.kind == VUT_GOVERNMENT) {
509 if (req->range == REQ_RANGE_PLAYER) {
510 if (context->player == NULL) {
511 /* The player (that may or may not possess the tech) may exist but
512 * not be passed when the problem type is RPT_POSSIBLE. */
513 return prob_type == RPT_CERTAIN;
514 }
515
516 return (pov_player == context->player
517 || could_intel_with_player(pov_player, context->player));
518 }
519 }
520
521 if (req->source.kind == VUT_MAXTILEUNITS) {
522 if (context->tile == NULL) {
523 /* The tile may exist but not be passed when the problem type is
524 * RPT_POSSIBLE. */
525 return prob_type == RPT_CERTAIN;
526 }
527
528 switch (req->range) {
529 case REQ_RANGE_LOCAL:
530 return can_player_see_hypotetic_units_at(pov_player, context->tile);
531 case REQ_RANGE_CADJACENT:
532 if (!can_player_see_hypotetic_units_at(pov_player, context->tile)) {
533 return FALSE;
534 }
535 cardinal_adjc_iterate(&(wld.map), context->tile, adjc_tile) {
536 if (!can_player_see_hypotetic_units_at(pov_player, adjc_tile)) {
537 return FALSE;
538 }
539 } cardinal_adjc_iterate_end;
540
541 return TRUE;
542 case REQ_RANGE_ADJACENT:
543 if (!can_player_see_hypotetic_units_at(pov_player, context->tile)) {
544 return FALSE;
545 }
546 adjc_iterate(&(wld.map), context->tile, adjc_tile) {
547 if (!can_player_see_hypotetic_units_at(pov_player, adjc_tile)) {
548 return FALSE;
549 }
550 } adjc_iterate_end;
551
552 return TRUE;
553 case REQ_RANGE_CONTINENT:
554 case REQ_RANGE_CITY:
555 case REQ_RANGE_TRADE_ROUTE:
556 case REQ_RANGE_PLAYER:
557 case REQ_RANGE_TEAM:
558 case REQ_RANGE_ALLIANCE:
559 case REQ_RANGE_WORLD:
560 case REQ_RANGE_COUNT:
561 /* Non existing. */
562 return FALSE;
563 }
564 }
565
566 if (req->source.kind == VUT_TERRAIN
567 || req->source.kind == VUT_TERRFLAG
568 || req->source.kind == VUT_TERRAINCLASS
569 || req->source.kind == VUT_TERRAINALTER
570 || req->source.kind == VUT_EXTRA
571 || req->source.kind == VUT_EXTRAFLAG
572 || req->source.kind == VUT_ROADFLAG) {
573 if (context->tile == NULL) {
574 /* The tile may exist but not be passed when the problem type is
575 * RPT_POSSIBLE. */
576 return prob_type == RPT_CERTAIN;
577 }
578
579 switch (req->range) {
580 case REQ_RANGE_LOCAL:
581 return tile_is_seen(context->tile, pov_player);
582 case REQ_RANGE_CADJACENT:
583 /* TODO: The answer is known when the universal is located on a seen
584 * tile. Is returning TRUE in those cases worth the added complexity
585 * and the extra work for the computer? */
586 return is_tile_seen_cadj(pov_player, context->tile);
587 case REQ_RANGE_ADJACENT:
588 /* TODO: The answer is known when the universal is located on a seen
589 * tile. Is returning TRUE in those cases worth the added complexity
590 * and the extra work for the computer? */
591 return is_tile_seen_adj(pov_player, context->tile);
592 case REQ_RANGE_CITY:
593 /* TODO: The answer is known when the universal is located on a seen
594 * tile. Is returning TRUE in those cases worth the added complexity
595 * and the extra work for the computer? */
596 return is_tile_seen_city(pov_player, context->city);
597 case REQ_RANGE_TRADE_ROUTE:
598 /* TODO: The answer is known when the universal is located on a seen
599 * tile. Is returning TRUE in those cases worth the added complexity
600 * and the extra work for the computer? */
601 return is_tile_seen_trade_route(pov_player, context->city);
602 case REQ_RANGE_CONTINENT:
603 case REQ_RANGE_PLAYER:
604 case REQ_RANGE_ALLIANCE:
605 case REQ_RANGE_TEAM:
606 case REQ_RANGE_WORLD:
607 case REQ_RANGE_COUNT:
608 /* Non existing range for requirement types. */
609 return FALSE;
610 }
611 }
612
613 if (req->source.kind == VUT_ACTION
614 || req->source.kind == VUT_OTYPE) {
615 /* This requirement type is intended to specify the situation. */
616 return TRUE;
617 }
618
619 if (req->source.kind == VUT_SERVERSETTING) {
620 /* Only visible server settings can be requirements. */
621 return TRUE;
622 }
623
624 /* Uncertain or no support added yet. */
625 return FALSE;
626}
627
628/**********************************************************************/
635enum fc_tristate
636mke_eval_req(const struct player *pov_player,
637 const struct req_context *context,
638 const struct player *other_player,
639 const struct requirement *req,
640 const enum req_problem_type prob_type)
641{
642 if (!is_req_knowable(pov_player, context, other_player,
643 req, prob_type)) {
644 return TRI_MAYBE;
645 }
646
647 if (is_req_active(context, other_player, req, prob_type)) {
648 return TRI_YES;
649 } else {
650 return TRI_NO;
651 }
652}
653
654/**********************************************************************/
661enum fc_tristate
662mke_eval_reqs(const struct player *pov_player,
663 const struct req_context *context,
664 const struct player *other_player,
665 const struct requirement_vector *reqs,
666 const enum req_problem_type prob_type)
667{
668 enum fc_tristate current;
669 enum fc_tristate result;
670
671 result = TRI_YES;
672 requirement_vector_iterate(reqs, preq) {
673 current = mke_eval_req(pov_player, context, other_player,
674 preq, prob_type);
675 if (current == TRI_NO) {
676 return TRI_NO;
677 } else if (current == TRI_MAYBE) {
678 result = TRI_MAYBE;
679 }
680 } requirement_vector_iterate_end;
681
682 return result;
683}
684
685/**********************************************************************/
688 bool can_see_techs_of_target(const struct player *pow_player,
689 const struct player *target_player)
690{
691 return pow_player == target_player
692 || team_has_embassy(pow_player->team, target_player);
693}
city_map_radius_sq_get
int city_map_radius_sq_get(const struct city *pcity)
Definition city.c:131
city_tile
#define city_tile(_pcity_)
Definition city.h:544
city_owner
#define city_owner(_pcity_)
Definition city.h:543
city_tile_iterate
#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile)
Definition city.h:222
city_tile_iterate_end
#define city_tile_iterate_end
Definition city.h:230
target_tile
struct unit struct city struct unit struct tile * target_tile
Definition dialogs_g.h:56
target_city
struct unit struct city * target_city
Definition dialogs_g.h:55
could_intel_with_player
bool could_intel_with_player(const struct player *pplayer, const struct player *aplayer)
Definition diptreaty.c:81
diptreaty.h
reqs
struct @21::@22 reqs
req_problem_type
req_problem_type
Definition fc_types.h:584
RPT_CERTAIN
@ RPT_CERTAIN
Definition fc_types.h:586
wld
struct world wld
Definition game.c:58
game.h
is_improvement_visible
bool is_improvement_visible(const struct impr_type *pimprove)
Definition improvement.c:391
fc_assert_msg
#define fc_assert_msg(condition, message,...)
Definition log.h:181
fc_assert
#define fc_assert(condition)
Definition log.h:176
fc_assert_ret_val_msg
#define fc_assert_ret_val_msg(condition, val, message,...)
Definition log.h:208
map.h
adjc_iterate_end
#define adjc_iterate_end
Definition map.h:427
cardinal_adjc_iterate_end
#define cardinal_adjc_iterate_end
Definition map.h:453
adjc_iterate
#define adjc_iterate(nmap, center_tile, itr_tile)
Definition map.h:422
cardinal_adjc_iterate
#define cardinal_adjc_iterate(nmap, center_tile, itr_tile)
Definition map.h:449
is_tile_seen_cadj
static bool is_tile_seen_cadj(const struct player *pow_player, const struct tile *target_tile)
Definition metaknowledge.c:30
can_see_techs_of_target
bool can_see_techs_of_target(const struct player *pow_player, const struct player *target_player)
Definition metaknowledge.c:688
is_tile_seen_city
static bool is_tile_seen_city(const struct player *pow_player, const struct city *target_city)
Definition metaknowledge.c:75
can_plr_see_all_sym_diplrels_of
static bool can_plr_see_all_sym_diplrels_of(const struct player *pplayer, const struct player *tplayer)
Definition metaknowledge.c:129
mke_eval_reqs
enum fc_tristate mke_eval_reqs(const struct player *pov_player, const struct req_context *context, const struct player *other_player, const struct requirement_vector *reqs, const enum req_problem_type prob_type)
Definition metaknowledge.c:662
is_tile_seen_trade_route
static bool is_tile_seen_trade_route(const struct player *pow_player, const struct city *target_city)
Definition metaknowledge.c:101
is_req_knowable
static bool is_req_knowable(const struct player *pov_player, const struct req_context *context, const struct player *other_player, const struct requirement *req, const enum req_problem_type prob_type)
Definition metaknowledge.c:160
mke_eval_req
enum fc_tristate mke_eval_req(const struct player *pov_player, const struct req_context *context, const struct player *other_player, const struct requirement *req, const enum req_problem_type prob_type)
Definition metaknowledge.c:636
is_tile_seen_adj
static bool is_tile_seen_adj(const struct player *pow_player, const struct tile *target_tile)
Definition metaknowledge.c:53
metaknowledge.h
can_player_see_unit
bool can_player_see_unit(const struct player *pplayer, const struct unit *punit)
Definition player.c:1084
team_has_embassy
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
Definition player.c:214
player_can_see_city_externals
bool player_can_see_city_externals(const struct player *pow_player, const struct city *target_city)
Definition player.c:1143
player_diplstate_get
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:317
can_player_see_hypotetic_units_at
bool can_player_see_hypotetic_units_at(const struct player *pplayer, const struct tile *ptile)
Definition player.c:984
can_player_see_city_internals
bool can_player_see_city_internals(const struct player *pplayer, const struct city *pcity)
Definition player.c:1129
req_context_empty
const struct req_context * req_context_empty(void)
Definition requirements.c:901
is_req_active
bool is_req_active(const struct req_context *context, const struct player *other_player, const struct requirement *req, const enum req_problem_type prob_type)
Definition requirements.c:4268
requirement_vector_iterate_end
#define requirement_vector_iterate_end
Definition requirements.h:93
requirement_vector_iterate
#define requirement_vector_iterate(req_vec, preq)
Definition requirements.h:91
fc_tristate
fc_tristate
Definition shared.h:46
TRI_YES
@ TRI_YES
Definition shared.h:46
TRI_NO
@ TRI_NO
Definition shared.h:46
TRI_MAYBE
@ TRI_MAYBE
Definition shared.h:46
city
Definition city.h:309
civ_map
Definition map_types.h:71
player
Definition player.h:249
player::team
struct team * team
Definition player.h:261
req_context
Definition requirements.h:99
req_context::tile
const struct tile * tile
Definition requirements.h:102
req_context::player
const struct player * player
Definition requirements.h:100
req_context::unit
const struct unit * unit
Definition requirements.h:105
req_context::city
const struct city * city
Definition requirements.h:101
requirement
Definition requirements.h:80
requirement::survives
bool survives
Definition requirements.h:83
requirement::range
enum req_range range
Definition requirements.h:82
requirement::source
struct universal source
Definition requirements.h:81
tile
Definition tile.h:49
universal::kind
enum universals_n kind
Definition fc_types.h:758
universal::value
universals_u value
Definition fc_types.h:757
world::map
struct civ_map map
Definition world_object.h:38
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
tile_is_seen
bool tile_is_seen(const struct tile *target_tile, const struct player *pow_player)
Definition tile.c:401
tile_city
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
tile.h
traderoutes.h
trade_partners_iterate_end
#define trade_partners_iterate_end
Definition traderoutes.h:165
trade_partners_iterate
#define trade_partners_iterate(c, p)
Definition traderoutes.h:160
universals_u::building
const struct impr_type * building
Definition fc_types.h:598
universals_u::unit_state
enum ustate_prop unit_state
Definition fc_types.h:631
unit_owner
#define unit_owner(_pu)
Definition unit.h:387