43#define log_request_ids(...)
44#define log_todo_lists(...)
45#define log_meta_callback(...) log_debug(__VA_ARGS__)
46#define log_debug_freeze(...)
59#define SPECLIST_TAG call
60#define SPECLIST_TYPE struct call
63#define call_list_iterate(calllist, pcall) \
64 TYPED_LIST_ITERATE(struct call, calllist, pcall)
65#define call_list_iterate_end LIST_ITERATE_END
67#define call_list_both_iterate(calllist, plink, pcall) \
68 TYPED_LIST_BOTH_ITERATE(struct call_list_link, struct call, \
69 calllist, plink, pcall)
70#define call_list_both_iterate_end LIST_BOTH_ITERATE_END
127 struct my_agent *
agent, ...)
132 const struct tile *ptile;
160 pcall2->cb_type = cb_type;
171 if (
pcall->agent->agent.level -
pcall2->agent->agent.level > 0) {
303 for (
i = 0;
i <
agents.entries_used;
i++) {
317 if (
agent->first_outstanding_request_id != 0
319 &&
agent->first_outstanding_request_id <=
321 &&
agent->last_outstanding_request_id >=
323 log_debug(
"A:%s: ignoring packet; outstanding [%d..%d] got=%d",
325 agent->last_outstanding_request_id,
371 for (
i = 0;
i <
agents.entries_used;
i++) {
397 priv_agent->stats.wait_at_network_requests = 0;
488 for (
i = 0;
i <
agents.entries_used;
i++) {
516 log_debug(
"A: agents_unit_changed(unit=%d) type=%s pos=(%d,%d) owner=%s",
520 for (
i = 0;
i <
agents.entries_used;
i++) {
541 log_debug(
"A: agents_new_unit(unit=%d) type=%s pos=(%d,%d) owner=%s",
545 for (
i = 0;
i <
agents.entries_used;
i++) {
567 log_debug(
"A: agents_remove_unit(unit=%d) type=%s pos=(%d,%d) owner=%s",
571 for (
i = 0;
i <
agents.entries_used;
i++) {
593 log_debug(
"A: agents_city_changed(city %d=\"%s\") owner=%s",
597 for (
i = 0;
i <
agents.entries_used;
i++) {
619 log_debug(
"A: agents_city_new(city %d=\"%s\") pos=(%d,%d) owner=%s",
623 for (
i = 0;
i <
agents.entries_used;
i++) {
645 log_debug(
"A: agents_city_remove(city %d=\"%s\") pos=(%d,%d) owner=%s",
649 for (
i = 0;
i <
agents.entries_used;
i++) {
674 for (
i = 0;
i <
agents.entries_used;
i++) {
698 for (
i = 0;
i <
agents.entries_used;
i++) {
722 for (
i = 0;
i <
agents.entries_used;
i++) {
758 agent->stats.wait_at_network++;
759 agent->stats.wait_at_network_requests +=
765 agent->first_outstanding_request_id = 0;
767 log_debug(
"A:%s: waited %fs in total for network; "
768 "requests=%d; waited %d times",
771 agent->stats.wait_at_network_requests,
772 agent->stats.wait_at_network);
817 for (
i = 0;
i <
agents.entries_used;
i++) {
820 if (
agent->first_outstanding_request_id != 0) {
#define log_todo_lists(...)
static struct my_agent * agent_by_name(const char *agent_name)
static void enqueue_call(enum oct type, enum callback_type cb_type, struct my_agent *agent,...)
static bool calls_are_equal(const struct call *pcall1, const struct call *pcall2)
void agents_unit_changed(struct unit *punit)
void agents_city_remove(struct city *pcity)
void agents_thaw_hint(void)
void agents_disconnect(void)
void agents_game_start(void)
void wait_for_requests(const char *agent_name, int first_request_id, int last_request_id)
void agents_tile_remove(struct tile *ptile)
void agents_city_new(struct city *pcity)
struct timer * network_wall_timer
int wait_at_network_requests
#define call_list_both_iterate_end
int first_outstanding_request_id
void agents_start_turn(void)
void agents_tile_changed(struct tile *ptile)
static void call_handle_methods(void)
void agents_unit_new(struct unit *punit)
static struct @130 agents
static struct call * remove_and_return_a_call(void)
struct @130::my_agent entries[MAX_AGENTS]
void agents_unit_remove(struct unit *punit)
static bool currently_running
static bool is_outstanding_request(struct my_agent *agent)
void agents_processing_started(void)
void agents_tile_new(struct tile *ptile)
void agents_processing_finished(void)
void agents_new_turn(void)
#define log_request_ids(...)
void agents_city_changed(struct city *pcity)
int last_outstanding_request_id
void cause_a_city_changed_for_agent(const char *name_of_calling_agent, struct city *pcity)
void agents_game_joined(void)
struct @130::my_agent::@131 stats
void register_agent(const struct agent *agent)
void cause_a_unit_changed_for_agent(const char *name_of_calling_agent, struct unit *punit)
static void execute_call(const struct call *call)
#define call_list_both_iterate(calllist, plink, pcall)
#define log_debug_freeze(...)
#define log_meta_callback(...)
void agents_freeze_hint(void)
void agents_before_new_turn(void)
const char * city_name_get(const struct city *pcity)
bool client_is_observer(void)
enum client_states client_state(void)
void wait_till_request_got_processed(int request_id)
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 * punit
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
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define log_debug(message,...)
#define log_error(message,...)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
void update_turn_done_button_state(void)
const char * nation_rule_name(const struct nation_type *pnation)
struct nation_type * nation_of_city(const struct city *pcity)
const char * player_name(const struct player *pplayer)
void(* unit_callbacks[CB_LAST])(int)
void(* tile_callbacks[CB_LAST])(struct tile *ptile)
char name[MAX_AGENT_NAME_LEN]
void(* city_callbacks[CB_LAST])(int)
void(* turn_start_notify)(void)
enum callback_type cb_type
int request_id_of_currently_handled_packet
struct connection::@61::@66 client
void timer_destroy(struct timer *t)
void timer_start(struct timer *t)
void timer_stop(struct timer *t)
struct timer * timer_new(enum timer_timetype type, enum timer_use use, const char *name)
double timer_read_seconds(struct timer *t)
const char * unit_rule_name(const struct unit *punit)