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

Freeciv-3.1

Loading...
Searching...
No Matches
Functions
metaknowledge.c File Reference
`#include "diptreaty.h"`
`#include "game.h"`
`#include "map.h"`
`#include "metaknowledge.h"`
`#include "tile.h"`
`#include "traderoutes.h"`

Go to the source code of this file.

## Functions

static bool | is_tile_seen_cadj (const struct player *pow_player, const struct tile *target_tile)
static bool | is_tile_seen_adj (const struct player *pow_player, const struct tile *target_tile)
static bool | is_tile_seen_city (const struct player *pow_player, const struct city *target_city)
static bool | is_tile_seen_trade_route (const struct player *pow_player, const struct city *target_city)
static bool | can_plr_see_all_sym_diplrels_of (const struct player *pplayer, const struct player *tplayer)
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)
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)
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)
bool | can_see_techs_of_target (const struct player *pow_player, const struct player *target_player)

## Function Documentation

## ◆ can_plr_see_all_sym_diplrels_of()

static bool can_plr_see_all_sym_diplrels_of | ( | const struct player * | pplayer,
|  | const struct player * | tplayer
| ) |  |

static

Returns TRUE iff pplayer can see all the symmetric diplomatic relationships of tplayer.

Definition at line 129 of file metaknowledge.c.

Referenced by is_req_knowable().

## ◆ can_see_techs_of_target()

bool can_see_techs_of_target | ( | const struct player * | pow_player,
|  | const struct player * | target_player
| ) |  |

Can pow_player see the techs of target player?

Definition at line 688 of file metaknowledge.c.

Referenced by choose_tech_to_steal(), is_action_possible(), is_req_knowable(), and tech_can_be_stolen().

## ◆ 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
| ) |  |

static

Is an evaluation of the requirement accurate when pov_player evaluates it?

context may be NULL. This is equivalent to passing an empty context.

TODO: Move the data to a data file. That will

- let non programmers help complete it and/or fix what is wrong
- let clients not written in C use the data

Definition at line 160 of file metaknowledge.c.

Referenced by mke_eval_req().

## ◆ is_tile_seen_adj()

static bool is_tile_seen_adj | ( | const struct player * | pow_player,
|  | const struct tile * | target_tile
| ) |  |

static

Returns TRUE iff the target_tile it self and all tiles adjacent to it are seen by pow_player.

Definition at line 53 of file metaknowledge.c.

Referenced by is_req_knowable().

## ◆ is_tile_seen_cadj()

static bool is_tile_seen_cadj | ( | const struct player * | pow_player,
|  | const struct tile * | target_tile
| ) |  |

static

Returns TRUE iff the target_tile it self and all tiles cardinally adjacent to it are seen by pow_player.

Definition at line 30 of file metaknowledge.c.

Referenced by is_req_knowable().

## ◆ is_tile_seen_city()

static bool is_tile_seen_city | ( | const struct player * | pow_player,
|  | const struct city * | target_city
| ) |  |

static

Returns TRUE iff all tiles of a city are seen by pow_player.

Definition at line 75 of file metaknowledge.c.

Referenced by is_req_knowable(), and is_tile_seen_trade_route().

## ◆ is_tile_seen_trade_route()

static bool is_tile_seen_trade_route | ( | const struct player * | pow_player,
|  | const struct city * | target_city
| ) |  |

static

Returns TRUE iff all the tiles of a city and all the tiles of its trade partners are seen by pow_player.

Definition at line 101 of file metaknowledge.c.

Referenced by is_req_knowable().

## ◆ 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
| ) |  |

Evaluate a single requirement given pov_player's knowledge.

context may be NULL. This is equivalent to passing an empty context.

Note: Assumed to use pov_player's data.

Definition at line 636 of file metaknowledge.c.

Referenced by mke_eval_reqs().

## ◆ 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
| ) |  |

Evaluate a requirement vector given pov_player's knowledge.

context may be NULL. This is equivalent to passing an empty context.

Note: Assumed to use pov_player's data.

Definition at line 662 of file metaknowledge.c.

Referenced by action_enabled_local(), action_maybe_possible_actor_unit(), and is_effect_val_known().