Bug #1130 » 0089-Unhardcode-wld.map-from-city_unit_unhappiness.patch
ai/default/daimilitary.c | ||
---|---|---|
const struct unit_type *orig_utype = best_choice->value.utype;
|
||
int victim_count = 1;
|
||
int needferry = 0;
|
||
bool unhap = dai_assess_military_unhappiness(pcity);
|
||
bool unhap;
|
||
struct ai_plr *plr_data = def_ai_player_data(pplayer, ait);
|
||
const struct civ_map *nmap = &(wld.map);
|
||
/* Has to be initialized to make gcc happy */
|
||
struct ai_city *acity_data = NULL;
|
||
unhap = dai_assess_military_unhappiness(nmap, pcity);
|
||
if (acity != NULL) {
|
||
acity_data = def_ai_city_data(acity, ait);
|
||
}
|
ai/default/daitools.c | ||
---|---|---|
sure whether it is fully general for all possible parameters/
|
||
combinations." --dwp
|
||
**************************************************************************/
|
||
bool dai_assess_military_unhappiness(struct city *pcity)
|
||
bool dai_assess_military_unhappiness(const struct civ_map *nmap,
|
||
struct city *pcity)
|
||
{
|
||
int free_unhappy = get_city_bonus(pcity, EFT_MAKE_CONTENT_MIL);
|
||
int unhap = 0;
|
||
... | ... | |
}
|
||
unit_list_iterate(pcity->units_supported, punit) {
|
||
int happy_cost = city_unit_unhappiness(punit, &free_unhappy);
|
||
int happy_cost = city_unit_unhappiness(nmap, punit, &free_unhappy);
|
||
if (happy_cost > 0) {
|
||
unhap += happy_cost;
|
ai/default/daitools.h | ||
---|---|---|
bool need_boat);
|
||
void dai_build_adv_override(struct ai_type *ait, struct city *pcity,
|
||
struct adv_choice *choice);
|
||
bool dai_assess_military_unhappiness(struct city *pcity);
|
||
bool dai_assess_military_unhappiness(const struct civ_map *nmap,
|
||
struct city *pcity);
|
||
void dai_consider_plr_dangerous(struct ai_type *ait, struct player *plr1,
|
||
struct player *plr2,
|
ai/default/daiunit.c | ||
---|---|---|
if (NULL != pcity && (0 == punit->id || pcity->id == punit->homecity)) {
|
||
/* I would have thought unhappiness should be taken into account
|
||
* irrespectfully the city in which it will surface... -- GB */
|
||
unhap = dai_assess_military_unhappiness(pcity);
|
||
unhap = dai_assess_military_unhappiness(nmap, pcity);
|
||
}
|
||
bcost = unit_build_shield_cost_base(punit);
|
client/gui-gtk-3.22/citydlg.c | ||
---|---|---|
int n, m, i;
|
||
gchar *buf;
|
||
int free_unhappy = get_city_bonus(pdialog->pcity, EFT_MAKE_CONTENT_MIL);
|
||
const struct civ_map *nmap = &(wld.map);
|
||
if (NULL != client.conn.playing
|
||
&& city_owner(pdialog->pcity) != client.conn.playing) {
|
||
... | ... | |
i = 0;
|
||
unit_list_iterate(units, punit) {
|
||
struct unit_node *pnode;
|
||
int happy_cost = city_unit_unhappiness(punit, &free_unhappy);
|
||
int happy_cost = city_unit_unhappiness(nmap, punit, &free_unhappy);
|
||
pnode = unit_node_vector_get(nodes, i);
|
||
if (pnode) {
|
client/gui-gtk-4.0/citydlg.c | ||
---|---|---|
int n, m, i;
|
||
gchar *buf;
|
||
int free_unhappy = get_city_bonus(pdialog->pcity, EFT_MAKE_CONTENT_MIL);
|
||
const struct civ_map *nmap = &(wld.map);
|
||
if (NULL != client.conn.playing
|
||
&& city_owner(pdialog->pcity) != client.conn.playing) {
|
||
... | ... | |
i = 0;
|
||
unit_list_iterate(units, punit) {
|
||
struct unit_node *pnode;
|
||
int happy_cost = city_unit_unhappiness(punit, &free_unhappy);
|
||
int happy_cost = city_unit_unhappiness(nmap, punit, &free_unhappy);
|
||
pnode = unit_node_vector_get(nodes, i);
|
||
if (pnode) {
|
client/gui-gtk-5.0/citydlg.c | ||
---|---|---|
int n, m, i;
|
||
gchar *buf;
|
||
int free_unhappy = get_city_bonus(pdialog->pcity, EFT_MAKE_CONTENT_MIL);
|
||
const struct civ_map *nmap = &(wld.map);
|
||
if (NULL != client.conn.playing
|
||
&& city_owner(pdialog->pcity) != client.conn.playing) {
|
||
... | ... | |
i = 0;
|
||
unit_list_iterate(units, punit) {
|
||
struct unit_node *pnode;
|
||
int happy_cost = city_unit_unhappiness(punit, &free_unhappy);
|
||
int happy_cost = city_unit_unhappiness(nmap, punit, &free_unhappy);
|
||
pnode = unit_node_vector_get(nodes, i);
|
||
if (pnode) {
|
client/gui-qt/citydlg.cpp | ||
---|---|---|
int happy_cost;
|
||
int free_unhappy = get_city_bonus(dlgcity, EFT_MAKE_CONTENT_MIL);
|
||
struct player *pplayer = client_player();
|
||
const struct civ_map *nmap = &(wld.map);
|
||
supported_units->setUpdatesEnabled(false);
|
||
supported_units->clear_layout();
|
||
... | ... | |
}
|
||
unit_list_iterate(units, punit) {
|
||
happy_cost = city_unit_unhappiness(punit, &free_unhappy);
|
||
happy_cost = city_unit_unhappiness(nmap, punit, &free_unhappy);
|
||
ui = new unit_item(this, punit, true, happy_cost);
|
||
ui->init_pix();
|
||
supported_units->add_item(ui);
|
client/gui-sdl2/citydlg.c | ||
---|---|---|
SDL_Rect src_rect;
|
||
SDL_Surface *psurf;
|
||
struct canvas *destcanvas;
|
||
const struct civ_map *nmap = &(wld.map);
|
||
destcanvas = canvas_create(tileset_full_tile_width(tileset),
|
||
tileset_unit_with_small_upkeep_height(tileset));
|
||
... | ... | |
src_rect.h = destcanvas->surf->h - src_rect.y;
|
||
free_unhappy = get_city_bonus(pcity_dlg->pcity, EFT_MAKE_CONTENT_MIL);
|
||
happy_cost = city_unit_unhappiness(punit, &free_unhappy);
|
||
happy_cost = city_unit_unhappiness(nmap, punit, &free_unhappy);
|
||
i = punit->upkeep[O_SHIELD] + punit->upkeep[O_FOOD] +
|
||
punit->upkeep[O_GOLD] + happy_cost;
|
client/gui-sdl3/citydlg.c | ||
---|---|---|
SDL_Rect src_rect;
|
||
SDL_Surface *psurf;
|
||
struct canvas *destcanvas;
|
||
const struct civ_map *nmap = &(wld.map);
|
||
destcanvas = canvas_create(tileset_full_tile_width(tileset),
|
||
tileset_unit_with_small_upkeep_height(tileset));
|
||
... | ... | |
src_rect.h = destcanvas->surf->h - src_rect.y;
|
||
free_unhappy = get_city_bonus(pcity_dlg->pcity, EFT_MAKE_CONTENT_MIL);
|
||
happy_cost = city_unit_unhappiness(punit, &free_unhappy);
|
||
happy_cost = city_unit_unhappiness(nmap, punit, &free_unhappy);
|
||
i = punit->upkeep[O_SHIELD] + punit->upkeep[O_FOOD] +
|
||
punit->upkeep[O_GOLD] + happy_cost;
|
common/city.c | ||
---|---|---|
/**********************************************************************//**
|
||
Query unhappiness caused by a given unit.
|
||
**************************************************************************/
|
||
int city_unit_unhappiness(struct unit *punit, int *free_unhappy)
|
||
int city_unit_unhappiness(const struct civ_map *nmap,
|
||
struct unit *punit, int *free_unhappy)
|
||
{
|
||
struct city *pcity;
|
||
const struct unit_type *ut;
|
||
struct player *plr;
|
||
int happy_cost;
|
||
const struct civ_map *nmap = &(wld.map);
|
||
if (punit == NULL || free_unhappy == NULL) {
|
||
return 0;
|
||
... | ... | |
{
|
||
int free_unhappy;
|
||
int max_mart_units;
|
||
const struct civ_map *nmap = &(wld.map);
|
||
/* Clear all usage values. */
|
||
memset(pcity->usage, 0, O_LAST * sizeof(*pcity->usage));
|
||
... | ... | |
free_unhappy = get_city_bonus(pcity, EFT_MAKE_CONTENT_MIL);
|
||
unit_list_iterate(pcity->units_supported, punit) {
|
||
pcity->unit_happy_upkeep += city_unit_unhappiness(punit, &free_unhappy);
|
||
pcity->unit_happy_upkeep += city_unit_unhappiness(nmap, punit, &free_unhappy);
|
||
output_type_iterate(o) {
|
||
if (O_GOLD != o) {
|
||
/* O_GOLD is handled with "game.info.gold_upkeep_style", see over. */
|
common/city.h | ||
---|---|---|
int city_population(const struct city *pcity);
|
||
int city_total_impr_gold_upkeep(const struct city *pcity);
|
||
int city_total_unit_gold_upkeep(const struct city *pcity);
|
||
int city_unit_unhappiness(struct unit *punit, int *free_unhappy);
|
||
bool city_happy(const struct city *pcity); /* generally use celebrating instead */
|
||
bool city_unhappy(const struct city *pcity); /* anarchy??? */
|
||
int city_unit_unhappiness(const struct civ_map *nmap,
|
||
struct unit *punit, int *free_unhappy);
|
||
bool city_happy(const struct city *pcity); /* Generally use celebrating instead */
|
||
bool city_unhappy(const struct city *pcity); /* Anarchy??? */
|
||
bool base_city_celebrating(const struct city *pcity);
|
||
bool city_celebrating(const struct city *pcity); /* love the king ??? */
|
||
bool city_celebrating(const struct city *pcity); /* Love the king ??? */
|
||
bool city_rapture_grow(const struct city *pcity);
|
||
bool city_is_occupied(const struct city *pcity);
|
||