Project

General

Profile

Feature #1409 » 0069-Pass-civ_map-to-city_gold_worth.patch

main - Marko Lindqvist, 05/24/2025 08:03 AM

View differences:

ai/default/daidiplomacy.c
{
bool close_here;
struct ai_plr *ai;
int worth = 0; /* worth for pplayer of what aplayer gives */
int worth = 0; /* Worth for pplayer of what aplayer gives */
bool give = (pplayer == pclause->from);
struct player *giver;
const struct player *penemy;
struct ai_dip_intel *adip = dai_diplomacy_get(ait, pplayer, aplayer);
bool is_dangerous;
const struct civ_map *nmap = &(wld.map);
ai = dai_plr_data_get(ait, pplayer, &close_here);
......
DIPLO_LOG(ait, LOG_DEBUG, pplayer, aplayer, "city destroyed during negotiations");
} else if (give) {
/* AI must be crazy to trade away its cities */
worth -= city_gold_worth(offer);
worth -= city_gold_worth(nmap, offer);
if (is_capital(offer)) {
worth = -BIG_NUMBER; /* Never! Ever! */
} else {
......
worth /= 2;
}
} else {
worth = city_gold_worth(offer);
worth = city_gold_worth(nmap, offer);
}
if (offer != NULL) {
DIPLO_LOG(ait, LOG_DEBUG, pplayer, aplayer, "worth of %s is %d",
common/aicore/aisupport.c
/*******************************************************************//**
Rough calculation of the worth of pcity in gold.
***********************************************************************/
int city_gold_worth(struct city *pcity)
int city_gold_worth(const struct civ_map *nmap, struct city *pcity)
{
struct player *pplayer = city_owner(pcity);
int worth = 0, i;
struct unit_type *u = nullptr;
const struct civ_map *nmap = &(wld.map);
if (!game.scenario.prevent_new_cities) {
u = best_role_unit_for_player(city_owner(pcity),
common/aicore/aisupport.h
struct city;
struct player;
struct civ_map;
struct player *player_leading_spacerace(void);
int player_distance_to_player(struct player *pplayer, struct player *target);
int city_gold_worth(struct city *pcity);
int city_gold_worth(const struct civ_map *nmap, struct city *pcity);
#ifdef __cplusplus
}
(1-1/2)