Feature #1106 ยป 0081-Unhardcode-wld.map-from-city_refresh_from_main_map.patch
ai/default/aihand.c | ||
---|---|---|
int rate_sci_balance = RATE_NOT_SET;
|
||
int rate_lux_min_celebrate = maxrate;
|
||
int delta_tax = 0, delta_sci = 0;
|
||
const struct civ_map *nmap = &(wld.map);
|
||
#ifdef DEBUG_TIMERS
|
||
struct timer *taxtimer = NULL;
|
||
... | ... | |
cm_query_result(pcity, &cmp, cmr, FALSE);
|
||
if (cmr->found_a_valid) {
|
||
apply_cmresult_to_city(pcity, cmr);
|
||
city_refresh_from_main_map(pcity, NULL);
|
||
city_refresh_from_main_map(nmap, pcity, NULL);
|
||
if (!city_happy(pcity)) {
|
||
CITY_LOG(LOG_ERROR, pcity, "is NOT happy when it should be!");
|
||
}
|
||
... | ... | |
/* KLUDGE: Must refresh to restore the original values which
|
||
* were clobbered in cm_query_result(), after the tax rates
|
||
* were changed. */
|
||
city_refresh_from_main_map(pcity, NULL);
|
||
city_refresh_from_main_map(nmap, pcity, NULL);
|
||
} city_list_iterate_end;
|
||
}
|
||
common/aicore/cm.c | ||
---|---|---|
{
|
||
struct city *pcity = state->pcity;
|
||
int i, city_radius_sq = city_map_radius_sq_get(pcity);
|
||
const struct civ_map *nmap = &(wld.map);
|
||
#ifndef FREECIV_NDEBUG
|
||
int citizen_count = 0;
|
||
#endif
|
||
... | ... | |
}
|
||
/* Finally we must refresh the city to reset all the precomputed fields. */
|
||
city_refresh_from_main_map(pcity, state->workers_map);
|
||
city_refresh_from_main_map(nmap, pcity, state->workers_map);
|
||
fc_assert_ret(citizen_count == city_size_get(pcity));
|
||
}
|
||
... | ... | |
struct cm_result *result, bool negative_ok)
|
||
{
|
||
struct cm_state *state = cm_state_init(pcity, negative_ok);
|
||
const struct civ_map *nmap = &(wld.map);
|
||
/* Refresh the city. Otherwise the CM can give wrong results or just be
|
||
* slower than necessary. Note that cities are often passed in in an
|
||
/* Refresh the city. Otherwise the CM can give wrong results or just be
|
||
* slower than necessary. Note that cities are often passed in in an
|
||
* unrefreshed state (which should probably be fixed). */
|
||
city_refresh_from_main_map(pcity, NULL);
|
||
city_refresh_from_main_map(nmap, pcity, NULL);
|
||
cm_find_best_solution(state, param, result, negative_ok);
|
||
cm_state_free(state);
|
common/city.c | ||
---|---|---|
workers within the city map. It uses the tile index and its size is
|
||
defined by city_map_tiles_from_city(_pcity). See also cm_state_init().
|
||
**************************************************************************/
|
||
static inline void get_worked_tile_output(const struct city *pcity,
|
||
static inline void get_worked_tile_output(const struct civ_map *nmap,
|
||
const struct city *pcity,
|
||
int *output, bool *workers_map)
|
||
{
|
||
bool is_worked;
|
||
... | ... | |
bool is_celebrating = base_city_celebrating(pcity);
|
||
#endif
|
||
struct tile *pcenter = city_tile(pcity);
|
||
const struct civ_map *nmap = &(wld.map);
|
||
memset(output, 0, O_LAST * sizeof(*output));
|
||
... | ... | |
If 'workers_map' is set, only basic updates are needed.
|
||
**************************************************************************/
|
||
void city_refresh_from_main_map(struct city *pcity, bool *workers_map)
|
||
void city_refresh_from_main_map(const struct civ_map *nmap,
|
||
struct city *pcity, bool *workers_map)
|
||
{
|
||
const struct civ_map *nmap = &(wld.map);
|
||
if (workers_map == NULL) {
|
||
/* do a full refresh */
|
||
... | ... | |
}
|
||
/* Calculate output from citizens (uses city_tile_cache_get_output()). */
|
||
get_worked_tile_output(pcity, pcity->citizen_base, workers_map);
|
||
get_worked_tile_output(nmap, pcity, pcity->citizen_base, workers_map);
|
||
add_specialist_output(pcity, pcity->citizen_base);
|
||
set_city_production(pcity);
|
||
... | ... | |
pcity->pollution = city_pollution(pcity, pcity->prod[O_SHIELD]);
|
||
happy_copy(pcity, FEELING_LUXURY);
|
||
citizen_happy_luxury(pcity); /* with our new found luxuries */
|
||
citizen_happy_luxury(pcity); /* With our new found luxuries */
|
||
happy_copy(pcity, FEELING_EFFECT);
|
||
citizen_content_buildings(pcity);
|
common/city.h | ||
---|---|---|
void city_remove_improvement(struct city *pcity,
|
||
const struct impr_type *pimprove);
|
||
/* city update functions */
|
||
void city_refresh_from_main_map(struct city *pcity, bool *workers_map);
|
||
/* City update functions */
|
||
void city_refresh_from_main_map(const struct civ_map *nmap,
|
||
struct city *pcity, bool *workers_map);
|
||
int city_waste(const struct city *pcity, Output_type_id otype, int total,
|
||
int *breakdown);
|
||
... | ... | |
int get_final_city_output_bonus(const struct city *pcity, Output_type_id otype);
|
||
bool city_built_last_turn(const struct city *pcity);
|
||
/* city creation / destruction */
|
||
/* City creation / destruction */
|
||
struct city *create_city_virtual(struct player *pplayer,
|
||
struct tile *ptile, const char *name);
|
||
void destroy_city_virtual(struct city *pcity);
|
||
bool city_is_virtual(const struct city *pcity);
|
||
/* misc */
|
||
/* Misc */
|
||
bool is_city_option_set(const struct city *pcity, enum city_options option);
|
||
void city_styles_alloc(int num);
|
||
void city_styles_free(void);
|
server/cityturn.c | ||
---|---|---|
bool city_refresh(struct city *pcity)
|
||
{
|
||
bool retval;
|
||
const struct civ_map *nmap = &(wld.map);
|
||
pcity->server.needs_refresh = FALSE;
|
||
retval = city_map_update_radius_sq(pcity);
|
||
city_units_upkeep(pcity); /* update unit upkeep */
|
||
city_refresh_from_main_map(pcity, NULL);
|
||
city_units_upkeep(pcity); /* Update unit upkeep */
|
||
city_refresh_from_main_map(nmap, pcity, NULL);
|
||
city_style_refresh(pcity);
|
||
if (retval) {
|
server/sanitycheck.c | ||
---|---|---|
city_specialists(pcity));
|
||
city_repair_size(pcity, delta);
|
||
city_refresh_from_main_map(pcity, NULL);
|
||
city_refresh_from_main_map(nmap, pcity, NULL);
|
||
}
|
||
}
|
||