Freeciv-3.3
|
#include <stdarg.h>
#include <string.h>
#include "capability.h"
#include "log.h"
#include "mem.h"
#include "timing.h"
#include "nation.h"
#include "client_main.h"
#include "mapctrl_g.h"
#include "cma_core.h"
#include "cma_fec.h"
#include "sha.h"
#include "agents.h"
#include "speclist.h"
Go to the source code of this file.
Data Structures | |
struct | call |
Macros | |
#define | log_request_ids(...) /* log_test(__VA_ARGS__) */ |
#define | log_todo_lists(...) /* log_test(__VA_ARGS__) */ |
#define | log_meta_callback(...) log_debug(__VA_ARGS__) |
#define | log_debug_freeze(...) /* log_test(__VA_ARGS__) */ |
#define | MAX_AGENTS 10 |
#define | SPECLIST_TAG call |
#define | SPECLIST_TYPE struct call |
#define | call_list_iterate(calllist, pcall) TYPED_LIST_ITERATE(struct call, calllist, pcall) |
#define | call_list_iterate_end LIST_ITERATE_END |
#define | call_list_both_iterate(calllist, plink, pcall) |
#define | call_list_both_iterate_end LIST_BOTH_ITERATE_END |
Variables | ||
struct { | ||
int entries_used | ||
struct my_agent { | ||
struct agent agent | ||
int first_outstanding_request_id | ||
int last_outstanding_request_id | ||
struct { | ||
struct timer * network_wall_timer | ||
int wait_at_network | ||
int wait_at_network_requests | ||
} stats | ||
} entries [MAX_AGENTS] | ||
struct call_list * calls | ||
} | agents | |
static bool | initialized = FALSE | |
static int | frozen_level | |
static bool | currently_running = FALSE | |
#define call_list_both_iterate_end LIST_BOTH_ITERATE_END |
#define call_list_iterate_end LIST_ITERATE_END |
#define log_debug_freeze | ( | ... | ) | /* log_test(__VA_ARGS__) */ |
#define log_meta_callback | ( | ... | ) | log_debug(__VA_ARGS__) |
#define log_request_ids | ( | ... | ) | /* log_test(__VA_ARGS__) */ |
#define log_todo_lists | ( | ... | ) | /* log_test(__VA_ARGS__) */ |
Helper.
Definition at line 299 of file agents.c.
Referenced by cause_a_city_changed_for_agent(), cause_a_unit_changed_for_agent(), and wait_for_requests().
Called from client/packhand.c.
Definition at line 467 of file agents.c.
Referenced by handle_end_turn().
Returns TRUE iff some agent is currently busy.
Definition at line 804 of file agents.c.
Referenced by can_end_turn(), and send_turn_done().
Called from client/packhand.c. See agents_unit_changed() for a generic documentation.
Definition at line 589 of file agents.c.
Referenced by handle_city_info(), and handle_city_short_info().
Called from client/packhand.c. See agents_unit_changed() for a generic documentation.
Definition at line 615 of file agents.c.
Referenced by handle_city_info(), and handle_city_short_info().
Called from client/packhand.c. See agents_unit_changed() for a generic documentation.
Definition at line 641 of file agents.c.
Referenced by handle_city_remove().
Called from client/packhand.c.
Definition at line 405 of file agents.c.
Referenced by set_client_state().
Free resources allocated for agents framework
Definition at line 349 of file agents.c.
Referenced by client_game_free(), and client_game_reset().
Called from client/packhand.c.
Definition at line 432 of file agents.c.
Referenced by handle_freeze_client(), and input_from_server().
Called from client/packhand.c.
Definition at line 450 of file agents.c.
Referenced by handle_server_join_reply().
Called from client/packhand.c.
Definition at line 458 of file agents.c.
Referenced by set_client_state().
Called once per client startup.
Definition at line 335 of file agents.c.
Referenced by client_game_init(), and client_game_reset().
Called from client/packhand.c. See agents_unit_changed() for a generic documentation.
Definition at line 484 of file agents.c.
Referenced by handle_new_year().
Called from client/packhand.c.
Definition at line 423 of file agents.c.
Referenced by handle_processing_finished().
Called from client/packhand.c.
Definition at line 414 of file agents.c.
Referenced by handle_processing_started().
Called from client/packhand.c.
Definition at line 475 of file agents.c.
Referenced by handle_start_phase().
Called from client/packhand.c.
Definition at line 441 of file agents.c.
Referenced by handle_thaw_client(), and input_from_server().
Called from client/packhand.c. See agents_unit_changed() for a generic documentation.
Definition at line 692 of file agents.c.
Referenced by handle_tile_info().
Called from client/packhand.c. See agents_unit_changed() for a generic documentation.
Definition at line 716 of file agents.c.
Referenced by handle_tile_info().
Called from client/packhand.c. See agents_unit_changed() for a generic documentation. Tiles got removed because of FOW.
Definition at line 668 of file agents.c.
Referenced by handle_tile_info().
Called from client/packhand.c. A call is created and added to the list of outstanding calls if an agent wants to be informed about this event and the change wasn't caused by the agent. We then try (this may not be successful in every case since we can be frozen or another call_handle_methods may be running higher up on the stack) to execute all outstanding calls.
Definition at line 512 of file agents.c.
Referenced by handle_unit_packet_common().
Called from client/packhand.c. See agents_unit_changed() for a generic documentation.
Definition at line 537 of file agents.c.
Referenced by handle_unit_packet_common().
Called from client/packhand.c. See agents_unit_changed() for a generic documentation.
Definition at line 563 of file agents.c.
Referenced by handle_unit_remove().
Execute all outstanding calls. This method will do nothing if the dispatching is frozen (frozen_level > 0). Also call_handle_methods will ensure that only one instance is running at any given time.
Definition at line 238 of file agents.c.
Referenced by agents_city_changed(), agents_city_new(), agents_city_remove(), agents_game_start(), agents_tile_changed(), agents_tile_new(), agents_tile_remove(), agents_unit_changed(), agents_unit_new(), agents_unit_remove(), cause_a_city_changed_for_agent(), cause_a_unit_changed_for_agent(), and thaw().
Return TRUE iff the two agent calls are equal.
Definition at line 96 of file agents.c.
Referenced by enqueue_call().
Adds a specific call for the given agent.
Definition at line 791 of file agents.c.
Referenced by cma_put_city_under_agent().
|
static |
If the call described by the given arguments isn't contained in agents.calls list, add the call to this list. Maintains the list in a sorted order.
Definition at line 125 of file agents.c.
Referenced by agents_city_changed(), agents_city_new(), agents_city_remove(), agents_new_turn(), agents_tile_changed(), agents_tile_new(), agents_tile_remove(), agents_unit_changed(), agents_unit_new(), agents_unit_remove(), cause_a_city_changed_for_agent(), and cause_a_unit_changed_for_agent().
Calls an callback of an agent as described in the given call.
Definition at line 214 of file agents.c.
Referenced by call_handle_methods().
Increase the frozen_level by one.
Definition at line 272 of file agents.c.
Referenced by agents_freeze_hint(), and agents_processing_started().
Returns TRUE iff currently handled packet was caused by the given agent.
Definition at line 315 of file agents.c.
Referenced by agents_city_changed(), agents_city_new(), agents_city_remove(), agents_new_turn(), agents_tile_changed(), agents_tile_new(), agents_tile_remove(), agents_unit_changed(), agents_unit_new(), and agents_unit_remove().
Registers an agent.
Definition at line 382 of file agents.c.
Referenced by cma_init(), cmafec_init(), and simple_historian_init().
Return an outstanding call. The call is removed from the agents.calls list. Returns NULL if there no more outstanding calls.
Definition at line 196 of file agents.c.
Referenced by agents_free(), and call_handle_methods().
Decrease the frozen_level by one. If the dispatching is not frozen anymore (frozen_level == 0) all outstanding calls are executed.
Definition at line 286 of file agents.c.
Referenced by agents_processing_finished(), and agents_thaw_hint().
Called from an agent. This function will return until the last request has been processed by the server.
Definition at line 740 of file agents.c.
Referenced by apply_result_on_server().
struct { ... } agents |
Referenced by agent_by_name(), agents_busy(), agents_city_changed(), agents_city_new(), agents_city_remove(), agents_free(), agents_init(), agents_new_turn(), agents_tile_changed(), agents_tile_new(), agents_tile_remove(), agents_unit_changed(), agents_unit_new(), agents_unit_remove(), enqueue_call(), register_agent(), and remove_and_return_a_call().
Definition at line 91 of file agents.c.
Referenced by agents_busy(), and call_handle_methods().
struct { ... } ::my_agent entries[MAX_AGENTS] |
int entries_used |
Definition at line 77 of file agents.c.
Referenced by economy_report_dialog_popup(), economy_report_update(), real_economy_report_dialog_update(), eco_report::update_report(), and fc_client::update_sidebar_tooltips().
|
static |
Definition at line 90 of file agents.c.
Referenced by agents_busy(), call_handle_methods(), freeze(), and thaw().
Definition at line 89 of file agents.c.
Referenced by agents_busy(), agents_disconnect(), and freeze().
struct { ... } stats |
Referenced by script_server_load_file().