Feature #1409 » 0040-Pass-civ_map-to-city_gold_worth.patch
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 = NULL;
|
||
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 | ||
---|---|---|
/* common */
|
||
#include "fc_types.h"
|
||
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
|
||
}
|
- « Previous
- 1
- 2
- Next »