Feature #403 » 0035-Unhardcode-wld.map-from-cowt_callback.patch
common/aicore/caravan.c | ||
---|---|---|
The callback should return TRUE if it wants to stop searching,
|
||
FALSE otherwise.
|
||
****************************************************************************/
|
||
typedef bool (*search_callback) (void *data, const struct city *pcity,
|
||
typedef bool (*search_callback) (const struct civ_map *nmap,
|
||
void *data, const struct city *pcity,
|
||
int arrival_turn, int arrival_moves_left);
|
||
static void caravan_search_from(const struct civ_map *nmap,
|
||
... | ... | |
}
|
||
pcity = tile_city(pos.tile);
|
||
if (pcity && callback(callback_data, pcity, turns_before + pos.turn,
|
||
if (pcity && callback(nmap, callback_data, pcity, turns_before + pos.turn,
|
||
pos.moves_left)) {
|
||
break;
|
||
}
|
||
... | ... | |
const struct caravan_parameter *param;
|
||
};
|
||
static bool cewt_callback(void *vdata, const struct city *dest,
|
||
static bool cewt_callback(const struct civ_map *nmap,
|
||
void *vdata, const struct city *dest,
|
||
int arrival_time, int moves_left)
|
||
{
|
||
struct cewt_data *data = vdata;
|
||
... | ... | |
struct caravan_result *best;
|
||
};
|
||
static bool cfbdw_callback(void *vdata, const struct city *dest,
|
||
static bool cfbdw_callback(const struct civ_map *nmap,
|
||
void *vdata, const struct city *dest,
|
||
int arrival_time, int moves_left)
|
||
{
|
||
struct cfbdw_data *data = vdata;
|
||
... | ... | |
For every city we can reach, use caravan_find_best_destination_withtransit()
|
||
as a subroutine.
|
||
****************************************************************************/
|
||
static bool cowt_callback(void *vdata, const struct city *pcity,
|
||
static bool cowt_callback(const struct civ_map *nmap, void *vdata,
|
||
const struct city *pcity,
|
||
int arrival_time, int moves_left)
|
||
{
|
||
struct cowt_data *data = vdata;
|
||
const struct unit *caravan = data->caravan;
|
||
struct caravan_result current;
|
||
const struct civ_map *nmap = &(wld.map);
|
||
caravan_result_init(¤t, game_city_by_number(caravan->homecity),
|
||
pcity, arrival_time);
|
- « Previous
- 1
- 2
- Next »