Feature #1353 ยป 0039-caravan.c-Replace-NULL-with-nullptr.patch
common/aicore/caravan.c | ||
---|---|---|
parameter->discount = 0.95;
|
||
parameter->consider_windfall = TRUE;
|
||
parameter->consider_trade = TRUE;
|
||
parameter->consider_wonders = TRUE; /* see also init_from_unit */
|
||
parameter->consider_wonders = TRUE; /* See also init_from_unit */
|
||
parameter->account_for_broken_routes = TRUE;
|
||
parameter->allow_foreign_trade = FTL_NATIONAL_ONLY;
|
||
parameter->ignore_transit_time = FALSE;
|
||
parameter->convert_trade = FALSE;
|
||
parameter->callback = NULL;
|
||
parameter->callback = nullptr;
|
||
}
|
||
/************************************************************************//**
|
||
... | ... | |
****************************************************************************/
|
||
void caravan_result_init_zero(struct caravan_result *result)
|
||
{
|
||
result->src = result->dest = NULL;
|
||
result->src = result->dest = nullptr;
|
||
result->arrival_time = 0;
|
||
result->value = 0;
|
||
result->help_wonder = FALSE;
|
||
... | ... | |
result->value = 0;
|
||
result->help_wonder = FALSE;
|
||
/* FIXME: required_boat field is never used. */
|
||
if ((src != NULL) && (dest != NULL)) {
|
||
/* FIXME: Required_boat field is never used. */
|
||
if ((src != nullptr) && (dest != nullptr)) {
|
||
if (tile_continent(src->tile) != tile_continent(dest->tile)) {
|
||
result->required_boat = TRUE;
|
||
} else {
|
||
... | ... | |
}
|
||
pcity = tile_city(pos.tile);
|
||
if (pcity != NULL
|
||
if (pcity != nullptr
|
||
&& callback(nmap, callback_data, pcity, turns_before + pos.turn,
|
||
pos.moves_left)) {
|
||
break;
|
||
... | ... | |
pgood->replace_priority));
|
||
int bonus = get_caravan_enter_city_trade_bonus(src, dest,
|
||
unit_type_get(caravan),
|
||
NULL, can_establish);
|
||
nullptr, can_establish);
|
||
/* when bonus goes to both sci and gold, double it */
|
||
/* When bonus goes to both sci and gold, double it */
|
||
if (TBONUS_BOTH == trade_route_settings_by_type
|
||
(cities_trade_route_type(src, dest))->bonus_type) {
|
||
bonus *= 2;
|
||
... | ... | |
losttrade = 0;
|
||
} else {
|
||
struct trade_route_list *would_remove
|
||
= (countloser ? trade_route_list_new() : NULL);
|
||
= (countloser ? trade_route_list_new() : nullptr);
|
||
int oldtrade = city_trade_removable(pcity, pgood->replace_priority,
|
||
would_remove);
|
||
... | ... | |
wonder = -1.0;
|
||
}
|
||
pgood = goods_from_city_to_unit(src, NULL);
|
||
pgood = goods_from_city_to_unit(src, nullptr);
|
||
if (consider_trade) {
|
||
trade = trade_benefit(pplayer_src, src, dest, pgood, parameter);
|
||
... | ... | |
struct city *pcity = game_city_by_number(caravan->homecity);
|
||
struct player *src_owner = city_owner(pcity);
|
||
caravan_result_init(best, pcity, NULL, 0);
|
||
caravan_result_init(best, pcity, nullptr, 0);
|
||
current = *best;
|
||
players_iterate(dest_owner) {
|
||
... | ... | |
data.param = param;
|
||
data.caravan = caravan;
|
||
data.best = result;
|
||
caravan_result_init(data.best, src, NULL, 0);
|
||
caravan_result_init(data.best, src, nullptr, 0);
|
||
if (src->id != caravan->homecity) {
|
||
start_tile = src->tile;
|
||
... | ... | |
/************************************************************************//**
|
||
Find the best destination city for the caravan.
|
||
Store it in *destout (if destout is non-null); return the value of the
|
||
Store it in *destout (if destout is non-nullptr); return the value of the
|
||
trade route.
|
||
****************************************************************************/
|
||
void caravan_find_best_destination(const struct civ_map *nmap,
|
||
... | ... | |
} else {
|
||
const struct city *src = game_city_by_number(caravan->homecity);
|
||
fc_assert(src != NULL);
|
||
fc_assert(src != nullptr);
|
||
caravan_find_best_destination_withtransit(nmap, caravan, parameter, src, 0,
|
||
caravan->moves_left, omniscient, result);
|