Freeciv-3.3
|
#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) |
#define BEST_NORMAL_TILE |
Definition at line 193 of file autoexplorer.c.
#define BEST_POSSIBLE_SCORE (HUT_SCORE + BEST_NORMAL_TILE) |
Definition at line 206 of file autoexplorer.c.
#define DIFF_TER_SCORE 81 |
Definition at line 174 of file autoexplorer.c.
#define DIST_FACTOR 0.6 |
#define HUT_SCORE (OWN_CITY_SCORE + 1) |
Definition at line 204 of file autoexplorer.c.
#define KNOWN_DIFF_TER_SCORE 51 |
Definition at line 176 of file autoexplorer.c.
#define KNOWN_SAME_TER_SCORE 0 |
Definition at line 175 of file autoexplorer.c.
#define MAX_NEW_TILES 5 |
Definition at line 182 of file autoexplorer.c.
#define OWN_CITY_SCORE (BEST_NORMAL_TILE + 1) |
Definition at line 199 of file autoexplorer.c.
#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 173 of file autoexplorer.c.
#define VISION_TILES 9 |
Definition at line 188 of file autoexplorer.c.
|
static |
Definition at line 208 of file autoexplorer.c.
Referenced by manage_auto_explorer().
Constrained goto using player_may_explore().
Definition at line 130 of file autoexplorer.c.
Referenced by manage_auto_explorer().
|
static |
TB function used by explorer_goto().
Definition at line 117 of file autoexplorer.c.
Referenced by explorer_goto().
|
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().
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 277 of file autoexplorer.c.
Referenced by dai_manage_military(), dai_manage_unit(), dai_military_attack(), do_explore(), and manage_auto_explorer().
|
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().