73#define log_apply_result log_debug
74#define log_handle_city log_debug
75#define log_handle_city2 log_debug
76#define log_results_are_equal log_debug
78#define SHOW_TIME_STATS FALSE
79#define SHOW_APPLY_RESULT_ON_SERVER_ERRORS FALSE
80#define ALWAYS_APPLY_AT_SERVER FALSE
82#define SAVED_PARAMETER_SIZE 30
83#define SAVED_PARAMETER_SIZE_OLD 29
85#define CMA_ATTR_VERSION 3
86#define CMA_ATTR_VERSION_MIN_SUPPORTED 2
103#define T(x) if (result1->x != result2->x) { \
104 log_results_are_equal(#x); \
125 if (
result1->worker_positions[cindex]
126 !=
result2->worker_positions[cindex]) {
183 stats.apply_result_ignored++;
190 log_error(
"apply_result_on_server(city %d=\"%s\") bad result!",
198 stats.apply_result_applied++;
292 stats.refresh_forced++;
302 log_verbose(
"apply_result_on_server(city %d) !check_city()!", city_id);
314#if SHOW_APPLY_RESULT_ON_SERVER_ERRORS
315 log_error(
"apply_result_on_server(city %d=\"%s\") no match!",
318 log_test(
"apply_result_on_server(city %d=\"%s\") have:",
323 log_test(
"apply_result_on_server(city %d=\"%s\") want:",
344 total =
stats.apply_result_ignored +
stats.apply_result_applied;
345 per_mill = (
stats.apply_result_ignored * 1000) / (total ? total : 1);
347 log_test(
"CMA: apply_result: ignored=%2d.%d%% (%d) "
348 "applied=%2d.%d%% (%d) total=%d",
351 stats.apply_result_applied, total);
386 for (
i = 0;
i < 5;
i++) {
403 _(
"The citizen governor can't fulfill the requirements "
412 _(
"The citizen governor has gotten confused dealing "
413 "with %s. You may want to have a look."),
432 _(
"The citizen governor has gotten confused dealing "
433 "with %s. You may want to have a look."),
484 (
unsigned int)
sizeof(
struct cm_result));
485 log_debug(
"sizeof(struct cm_parameter)=%d",
527 log_debug(
"cma_put_city_under_agent(city %d=\"%s\")",
536 log_debug(
"cma_put_city_under_agent: return");
561 if (parameter !=
NULL) {
597 log_error(
"CMA data has a wrong version %d (expected %d)",
void wait_for_requests(const char *agent_name, int first_request_id, int last_request_id)
void cause_a_city_changed_for_agent(const char *name_of_calling_agent, struct city *pcity)
void register_agent(const struct agent *agent)
size_t attr_city_get(enum attr_city what, int city_id, size_t max_data_length, void *data)
void attr_city_set(enum attr_city what, int city_id, size_t data_length, const void *const data)
@ ATTR_CITY_CMA_PARAMETER
void bugreport_request(const char *reason_format,...)
const char * city_name_get(const struct city *pcity)
int city_map_radius_sq_get(const struct city *pcity)
bool city_can_work_tile(const struct city *pcity, const struct tile *ptile)
#define city_tile(_pcity_)
static citizens city_size_get(const struct city *pcity)
#define city_tile_iterate_skip_free_worked(_nmap, _radius_sq, _city_tile, _tile, _index, _x, _y)
#define output_type_iterate(output)
#define city_owner(_pcity_)
#define city_tile_iterate_skip_free_worked_end
#define city_map_iterate_end
#define city_map_iterate(_radius_sq, _index, _x, _y)
#define is_free_worked_index(city_tile_index)
#define output_type_iterate_end
int city_change_specialist(struct city *pcity, Specialist_type_id from, Specialist_type_id to)
void refresh_city_dialog(struct city *pcity)
void city_report_dialog_update_city(struct city *pcity)
static struct ai_type * self
void create_event(struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
void cm_clear_cache(struct city *pcity)
void cm_init_parameter(struct cm_parameter *dest)
struct cm_result * cm_result_new(struct city *pcity)
void cm_result_from_main_map(struct cm_result *result, const struct city *pcity)
void cm_result_destroy(struct cm_result *result)
void cm_print_result(const struct cm_result *result)
void cm_query_result(struct city *pcity, const struct cm_parameter *param, struct cm_result *result, bool negative_ok)
int cm_result_citizens(const struct cm_result *result)
void cm_print_city(const struct city *pcity)
#define ALWAYS_APPLY_AT_SERVER
static struct city * check_city(int city_id, struct cm_parameter *parameter)
#define CMA_ATTR_VERSION_MIN_SUPPORTED
static void report_stats(void)
#define SAVED_PARAMETER_SIZE
#define log_results_are_equal
bool cma_is_city_under_agent(const struct city *pcity, struct cm_parameter *parameter)
static void city_changed(int city_id)
static void release_city(int city_id)
struct timer * wall_timer
void cma_put_city_under_agent(struct city *pcity, const struct cm_parameter *const parameter)
static void city_remove(int city_id)
static void new_turn(void)
static void handle_city(struct city *pcity)
bool cma_get_parameter(enum attr_city attr, int city_id, struct cm_parameter *parameter)
static bool apply_result_on_server(struct city *pcity, const struct cm_result *result)
static bool fc_results_are_equal(const struct cm_result *result1, const struct cm_result *result2)
void cma_release_city(struct city *pcity)
void cma_set_parameter(enum attr_city attr, int city_id, const struct cm_parameter *parameter)
bool cma_apply_result(struct city *pcity, const struct cm_result *result)
#define SAVED_PARAMETER_SIZE_OLD
void connection_do_buffer(struct connection *pc)
void connection_do_unbuffer(struct connection *pc)
int dio_put_uint8_raw(struct raw_data_out *dout, int value)
void dio_output_init(struct raw_data_out *dout, void *destination, size_t dest_size)
bool dio_get_sint16_raw(struct data_in *din, int *dest)
int dio_put_bool8_raw(struct raw_data_out *dout, bool value)
bool dio_get_uint8_raw(struct data_in *din, int *dest)
bool dio_get_bool8_raw(struct data_in *din, bool *dest)
size_t dio_output_used(struct raw_data_out *dout)
void dio_input_init(struct data_in *din, const void *src, size_t src_size)
int dio_put_sint16_raw(struct raw_data_out *dout, int value)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
const struct ft_color ftc_client
const char * city_link(const struct city *pcity)
struct city * game_city_by_number(int id)
#define fc_assert_ret(condition)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
#define log_error(message,...)
const char * nation_rule_name(const struct nation_type *pnation)
struct nation_type * nation_of_city(const struct city *pcity)
int dsend_packet_city_make_specialist(struct connection *pc, int city_id, int tile_id)
int dsend_packet_city_refresh(struct connection *pc, int city_id)
int dsend_packet_city_make_worker(struct connection *pc, int city_id, int tile_id)
struct specialist specialists[SP_MAX]
#define specialist_type_iterate_end
#define specialist_type_iterate(sp)
#define DEFAULT_SPECIALIST
int minimal_surplus[O_LAST]
citizens specialists[SP_MAX]
#define tile_worked(_tile)
struct timer * timer_renew(struct timer *t, enum timer_timetype type, enum timer_use use, const char *name)