Freeciv-3.2: /fast/freeciv/nightly/S3_2/server/advisors/autoexplorer.c File Reference

Freeciv-3.2

Loading...
Searching...
No Matches
Macros | Functions
autoexplorer.c File Reference
`#include <math.h>`
`#include "bitvector.h"`
`#include "log.h"`
`#include "ai.h"`
`#include "map.h"`
`#include "movement.h"`
`#include "player.h"`
`#include "unit.h"`
`#include "path_finding.h"`
`#include "pf_tools.h"`
`#include "maphand.h"`
`#include "srv_log.h"`
`#include "advgoto.h"`
`#include "handicaps.h"`
`#include "autoexplorer.h"`

Go to the source code of this file.

## Macros

#define | SAME_TER_SCORE 21
#define | DIFF_TER_SCORE 81
#define | KNOWN_SAME_TER_SCORE 0
#define | KNOWN_DIFF_TER_SCORE 51
#define | MAX_NEW_TILES 5
#define | VISION_TILES 9
#define | BEST_NORMAL_TILE
#define | OWN_CITY_SCORE (BEST_NORMAL_TILE + 1)
#define | HUT_SCORE (OWN_CITY_SCORE + 1)
#define | BEST_POSSIBLE_SCORE (HUT_SCORE + BEST_NORMAL_TILE)
#define | DIST_FACTOR 0.6

## Functions

static int | likely_native (struct tile *ptile, struct player *pplayer, struct unit_class *pclass)
static bool | player_may_explore (const struct tile *ptile, const struct player *pplayer, const struct unit_type *punittype)
static enum tile_behavior | explorer_tb (const struct tile *ptile, enum known_type k, const struct pf_parameter *param)
static bool | explorer_goto (struct unit *punit, struct tile *ptile)
static int | explorer_desirable (struct tile *ptile, struct player *pplayer, struct unit *punit)
enum unit_move_result | manage_auto_explorer (struct unit *punit)

## Macro Definition Documentation

## ◆ BEST_NORMAL_TILE

#define BEST_NORMAL_TILE

Value:
(100 * MAX_NEW_TILES * DIFF_TER_SCORE +\
100 * (VISION_TILES - MAX_NEW_TILES) * KNOWN_DIFF_TER_SCORE)
DIFF_TER_SCORE
#define DIFF_TER_SCORE
Definition autoexplorer.c:170
VISION_TILES
#define VISION_TILES
Definition autoexplorer.c:184
KNOWN_DIFF_TER_SCORE
#define KNOWN_DIFF_TER_SCORE
Definition autoexplorer.c:172
MAX_NEW_TILES
#define MAX_NEW_TILES
Definition autoexplorer.c:178

Definition at line 189 of file autoexplorer.c.

## ◆ BEST_POSSIBLE_SCORE

#define BEST_POSSIBLE_SCORE (HUT_SCORE + BEST_NORMAL_TILE)

Definition at line 202 of file autoexplorer.c.

## ◆ DIFF_TER_SCORE

#define DIFF_TER_SCORE 81

Definition at line 170 of file autoexplorer.c.

## ◆ DIST_FACTOR

#define DIST_FACTOR 0.6

## ◆ HUT_SCORE

#define HUT_SCORE (OWN_CITY_SCORE + 1)

Definition at line 200 of file autoexplorer.c.

## ◆ KNOWN_DIFF_TER_SCORE

#define KNOWN_DIFF_TER_SCORE 51

Definition at line 172 of file autoexplorer.c.

## ◆ KNOWN_SAME_TER_SCORE

#define KNOWN_SAME_TER_SCORE 0

Definition at line 171 of file autoexplorer.c.

## ◆ MAX_NEW_TILES

#define MAX_NEW_TILES 5

Definition at line 178 of file autoexplorer.c.

## ◆ OWN_CITY_SCORE

#define OWN_CITY_SCORE (BEST_NORMAL_TILE + 1)

Definition at line 195 of file autoexplorer.c.

## ◆ SAME_TER_SCORE

#define SAME_TER_SCORE 21

Return a value indicating how desirable it is to explore the given tile. In general, we want to discover unknown terrain of the opposite kind to our natural terrain, i.e., pedestrians like ocean and boats like land. Even if terrain is known, but of opposite kind, we still want it – so that we follow the shoreline. We also would like discovering tiles which can be harvested by our cities – because that improves citizen placement. We do not currently do this, see comment below.

Definition at line 169 of file autoexplorer.c.

## ◆ VISION_TILES

#define VISION_TILES 9

Definition at line 184 of file autoexplorer.c.

## Function Documentation

## ◆ explorer_desirable()

static int explorer_desirable | ( | struct tile * | ptile,
|  | struct player * | pplayer,
|  | struct unit * | punit
| ) |  |

static

Definition at line 204 of file autoexplorer.c.

Referenced by manage_auto_explorer().

## ◆ explorer_goto()

static bool explorer_goto | ( | struct unit * | punit,
|  | struct tile * | ptile
| ) |  |

static

Constrained goto using player_may_explore().

Definition at line 126 of file autoexplorer.c.

Referenced by manage_auto_explorer().

## ◆ explorer_tb()

static enum tile_behavior explorer_tb | ( | const struct tile * | ptile,
|  | enum known_type | k,
|  | const struct pf_parameter * | param
| ) |  |

static

TB function used by explorer_goto().

Definition at line 113 of file autoexplorer.c.

Referenced by explorer_goto().

## ◆ likely_native()

static int likely_native | ( | struct tile * | ptile,
|  | struct player * | pplayer,
|  | struct unit_class * | pclass
| ) |  |

static

Determine if a tile is likely to be native, given information that the player actually has. Return the % certainty that it's native (100 = certain, 50 = no idea, 0 = certainly not).

Definition at line 53 of file autoexplorer.c.

Referenced by explorer_desirable().

## ◆ manage_auto_explorer()

enum unit_move_result manage_auto_explorer | ( | struct unit * | punit | ) |

Handle eXplore mode of a unit (explorers are always in eXplore mode for AI) - explores unknown territory, finds huts.

MR_OK: there is more territory to be explored. MR_DEATH: unit died. MR_PAUSE: unit cannot explore further now. Other results: unit cannot explore further.

Definition at line 273 of file autoexplorer.c.

Referenced by dai_manage_military(), dai_manage_unit(), dai_military_attack(), do_explore(), and manage_auto_explorer().

## ◆ player_may_explore()

static bool player_may_explore | ( | const struct tile * | ptile,
|  | const struct player * | pplayer,
|  | const struct unit_type * | punittype
| ) |  |

static

Returns TRUE if a unit owned by the given player can safely "explore" the given tile. This mainly takes care that military units do not try to move into another player's territory in violation of a treaty.

Definition at line 86 of file autoexplorer.c.

Referenced by explorer_desirable(), and explorer_tb().