![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <cmath>#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"
Include dependency graph for autoexplorer.cpp:Go to the source code of this file.
Macros | |
| #define | SAME_TER_SCORE 21 |
| Return a value indicating how desirable it is to explore the given tile. More... | |
| #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) |
| Determine if a tile is likely to be native, given information that the player actually has. More... | |
| static bool | player_may_explore (const struct tile *ptile, const struct player *pplayer, const struct unit_type *punittype) |
| Returns TRUE if a unit owned by the given player can safely "explore" the given tile. More... | |
| static enum tile_behavior | explorer_tb (const struct tile *ptile, enum known_type k, const struct pf_parameter *param) |
| TB function used by explorer_goto(). More... | |
| static bool | explorer_goto (struct unit *punit, struct tile *ptile) |
| Constrained goto using player_may_explore(). More... | |
| static int | explorer_desirable (struct tile *ptile, struct player *pplayer, struct unit *punit) |
| 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. More... | |
| #define BEST_NORMAL_TILE |
Definition at line 182 of file autoexplorer.cpp.
| #define BEST_POSSIBLE_SCORE (HUT_SCORE + BEST_NORMAL_TILE) |
Definition at line 195 of file autoexplorer.cpp.
| #define DIFF_TER_SCORE 81 |
Definition at line 162 of file autoexplorer.cpp.
| #define DIST_FACTOR 0.6 |
| #define HUT_SCORE (OWN_CITY_SCORE + 1) |
Definition at line 193 of file autoexplorer.cpp.
| #define KNOWN_DIFF_TER_SCORE 51 |
Definition at line 164 of file autoexplorer.cpp.
| #define KNOWN_SAME_TER_SCORE 0 |
Definition at line 163 of file autoexplorer.cpp.
| #define MAX_NEW_TILES 5 |
Definition at line 171 of file autoexplorer.cpp.
| #define OWN_CITY_SCORE (BEST_NORMAL_TILE + 1) |
Definition at line 188 of file autoexplorer.cpp.
| #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 161 of file autoexplorer.cpp.
| #define VISION_TILES 9 |
Definition at line 177 of file autoexplorer.cpp.
|
static |
Definition at line 197 of file autoexplorer.cpp.
Constrained goto using player_may_explore().
Definition at line 119 of file autoexplorer.cpp.
|
static |
TB function used by explorer_goto().
Definition at line 79 of file autoexplorer.cpp.
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 45 of file autoexplorer.cpp.
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 197 of file autoexplorer.cpp.
Referenced by dai_manage_military(), dai_manage_unit(), dai_military_attack(), and do_explore().
|
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 79 of file autoexplorer.cpp.
Referenced by explorer_desirable().