Feature #333 ยป 0034-aicore-Clear-trailing-spaces.patch
common/aicore/caravan.c | ||
---|---|---|
int turns_before,
|
||
int moves_left,
|
||
bool omniscient,
|
||
struct caravan_result *result)
|
||
struct caravan_result *result)
|
||
{
|
||
struct tile *start_tile;
|
||
struct cfbdw_data data;
|
common/aicore/citymap.c | ||
---|---|---|
/* CITYMAP - reserve space for cities
|
||
*
|
||
* The citymap is a large int double array that corresponds to
|
||
* the freeciv main map. For each tile, it stores three different
|
||
* the freeciv main map. For each tile, it stores three different
|
||
* and exclusive values in a single int: A positive int tells you
|
||
* how many cities can use this tile (a crowdedness inidicator). A
|
||
* value of zero indicates that the tile is presently unused and
|
||
* available. A negative value means that this tile is occupied
|
||
* how many cities can use this tile (a crowdedness inidicator).
|
||
* A value of zero indicates that the tile is presently unused and
|
||
* available. A negative value means that this tile is occupied
|
||
* and reserved by some city or unit: in this case the value gives
|
||
* the negative of the ID of the city or unit that has reserved the
|
||
* tile.
|
||
... | ... | |
/**********************************************************************//**
|
||
This function reserves a single tile for a (possibly virtual) city with
|
||
a settler's or a city's id. Then it 'crowds' tiles that this city can
|
||
a settler's or a city's id. Then it 'crowds' tiles that this city can
|
||
use to make them less attractive to other cities we may consider making.
|
||
**************************************************************************/
|
||
void citymap_reserve_city_spot(struct tile *ptile, int id)
|
||
{
|
||
#ifdef FREECIV_DEBUG
|
||
log_citymap("id %d reserving (%d, %d), was %d",
|
||
log_citymap("id %d reserving (%d, %d), was %d",
|
||
id, TILE_XY(ptile), citymap[tile_index(ptile)]);
|
||
fc_assert_ret(0 <= citymap[tile_index(ptile)]);
|
||
#endif /* FREECIV_DEBUG */
|
common/aicore/path_finding.c | ||
---|---|---|
/* Up-cast macro. */
|
||
#ifdef PF_DEBUG
|
||
static inline struct pf_normal_map *
|
||
pf_normal_map_check(struct pf_map *pfm, const char *file,
|
||
pf_normal_map_check(struct pf_map *pfm, const char *file,
|
||
const char *function, int line)
|
||
{
|
||
fc_assert_full(file, function, line,
|
||
... | ... | |
Example: be A, B, C and D points safe positions, E a dangerous one.
|
||
A B
|
||
E
|
||
E
|
||
C D
|
||
We have found dangerous path from A to D, and later one from C to B:
|
||
A B A B
|
||
\ /
|
||
\ /
|
||
C D C D
|
||
If we didn't save the segment from A to D when a new segment passing by E
|
||
is found, then finding the path from A to D will produce an error. (The
|
||
... | ... | |
/************************************************************************//**
|
||
Tries to find the best path in the given map to the position ptile.
|
||
If NULL is returned no path could be found. The pf_path_last_position()
|
||
of such path would be the same (almost) as the result of the call to
|
||
of such path would be the same (almost) as the result of the call to
|
||
pf_map_position(). If ptile has not been reached yet, iterate the map
|
||
until we reach it or run out of map.
|
||
****************************************************************************/
|
common/aicore/pf_tools.c | ||
---|---|---|
if (PF_ACTION_ATTACK == action) {
|
||
return (PF_MS_NATIVE & src_scope
|
||
|| can_attack_from_non_native(param->utype));
|
||
|
||
} else if (PF_ACTION_DIPLOMAT == action
|
||
|| PF_ACTION_TRADE_ROUTE == action) {
|
||
/* Don't try to act when inside of a transport over non native terrain
|
||
... | ... | |
/************************************************************************//**
|
||
Determines if the move between two tiles is possible.
|
||
Do not use this function as part of a test of whether a unit may attack a
|
||
tile: many tiles that pass this test may be unsuitable for some units to
|
||
Do not use this function as part of a test of whether a unit may attack
|
||
a tile: many tiles that pass this test may be unsuitable for some units to
|
||
attack to/from.
|
||
Does not check if the tile is occupied by non-allied units.
|
||
... | ... | |
/* ===================== Tile Behaviour Callbacks ==================== */
|
||
/************************************************************************//**
|
||
PF callback to prohibit going into the unknown. Also makes sure we
|
||
PF callback to prohibit going into the unknown. Also makes sure we
|
||
don't plan to attack anyone.
|
||
****************************************************************************/
|
||
enum tile_behavior no_fights_or_unknown(const struct tile *ptile,
|
common/aicore/pf_tools.h | ||
---|---|---|
/* common/aicore */
|
||
#include "path_finding.h"
|
||
/*
|
||
/*
|
||
* Use to create 'amphibious' paths. An amphibious path starts on a sea tile,
|
||
* perhaps goes over some other sea tiles, then perhaps goes over some land
|
||
* tiles. This is suitable for a land unit riding on a ferry.
|