85 if (!hash.contains(request_id)) {
88 list = hash.value(request_id);
89 for (
auto wq_data : qAsConst(*list)) {
92 hash.remove(request_id);
99 if (
nullptr != wq_data->
uq_data) {
112 if (!hash.contains(request_id)) {
114 hash.insert(request_id, wqlist);
116 wqlist = hash.value(request_id);
123 while (!
queue.isEmpty()) {
129 for (
auto data : qAsConst(*a)) {
173 while (!
queue.isEmpty()) {
174 pair =
queue.dequeue();
175 auto callback = pair.first;
176 auto uq_data = pair.second;
177 callback(uq_data->data);
188 for (
auto p : qAsConst(
queue)) {
189 if (p.first == callback)
192 auto pr = qMakePair(callback, uqr_data);
197 queue.enqueue(qMakePair(callback, uq_data));
215 for (
auto pair : qAsConst(
queue)) {
216 if (pair.first == callback)
227 for (
auto p : qAsConst(
queue)) {
228 if (p.first == callback)
232 if (
nullptr !=
data) {
263 if (d->callback == callback && d->uq_data->data ==
data) {
294 log_debug(
"Requested page: %s.", client_pages_name(page));
302 log_debug(
"Requested server start + page: %s.", client_pages_name(page));
362 #define NEED_UPDATE(city_update, action) \
363 if (city_update & need_update) { \
365 need_update = static_cast<city_updates>(need_update & ~city_update); \
368 #define NEED_UPDATE(city_update, action) \
369 if (city_update & need_update) { \
376 enum city_updates need_update = pcity->client.need_updates;
391 qCritical(
"Some city updates not handled "
392 "for city %s (id %d): %d left.",
404 pcity->
client.need_updates =
413 pcity->
client.need_updates =
422 pcity->
client.need_updates =
const char * city_name_get(const struct city *pcity)
Return the name of the city.
#define cities_iterate_end
#define cities_iterate(pcity)
void real_city_dialog_popup(struct city *pcity)
Pop up (or bring to the front) a dialog for the given city.
void real_city_dialog_refresh(struct city *pcity)
Refresh (update) all data for the given city's dialog.
void real_city_report_dialog_update(void *unused)
Update (refresh) the entire city report dialog.
void real_city_report_update_city(struct city *pcity)
Update the information for a single city in the city report.
bool has_callback_full(uq_callback_t cb, const void **data, uq_free_fn_t *free_fn)
waitingQueue wq_processing_finished
static update_queue * uq()
void connect_processing_finished_unique(int request_id, uq_callback_t cb, void *data)
Connects the callback to the end of the processing (in server side) of the request.
void wq_data_destroy(struct waiting_queue_data *wq_data)
void wq_run_requests(waitingQueue &hash, int request_id)
static update_queue * m_instance
struct waiting_queue_data * wq_data_new(uq_callback_t callback, void *data, uq_free_fn_t free_fn)
struct update_queue_data * wq_data_extract(struct waiting_queue_data *wq_data)
bool has_callback(uq_callback_t callback)
void connect_processing_finished_full(int request_id, uq_callback_t cb, void *data, uq_free_fn_t free_func)
void data_destroy(struct update_queue_data *dt)
void connect_processing_finished(int request_id, uq_callback_t cb, void *data)
void push(uq_callback_t cb, struct update_queue_data *dt)
void wq_add_request(waitingQueue &hash, int request_id, uq_callback_t cb, void *data, uq_free_fn_t free_fn)
QQueue< updatePair > queue
struct update_queue_data * data_new(void *data, uq_free_fn_t free_fn)
void add(uq_callback_t callback, void *data)
void processing_finished(int request_id)
QUrl & client_url()
Returns the URL that this client connects to.
bool client_start_server(const QString &user_name)
Forks a server if it can.
void unit_select_dialog_update_real(void *unused)
Update the dialog window to select units on a particular tile.
enum client_pages get_current_client_page()
Returns current client page.
void real_set_client_page(enum client_pages page)
Sets the "page" that the client should show.
void real_science_report_dialog_update(void *)
Update the science report.
void real_conn_list_dialog_update(void *unused)
Update the connected users list at pregame state.
#define fc_assert_ret(condition)
#define log_debug(message,...)
void real_multipliers_dialog_update(void *unused)
Update multipliers (policies) dialog.
void real_economy_report_dialog_update(void *unused)
Update the economy report.
struct city::@15::@18 client
struct connection::@55::@60 client
uq_free_fn_t free_data_func
struct update_queue_data * uq_data
bool update_queue_is_switching_page(void)
void client_start_server_and_set_page(enum client_pages page)
void conn_list_dialog_update(void)
void economy_report_dialog_update(void)
void set_client_page(enum client_pages page)
void multipliers_dialog_update(void)
void city_report_dialog_update_city(struct city *pcity)
void science_report_dialog_update(void)
void popup_city_dialog(struct city *pcity)
static void set_client_page_callback(void *data)
static void cities_update_callback(void *data)
void refresh_city_dialog(struct city *pcity)
void units_report_dialog_update(void)
void players_dialog_update(void)
#define NEED_UPDATE(city_update, action)
void city_report_dialog_update(void)
enum client_pages get_client_page(void)
void unit_select_dialog_update(void)
static void menus_update_callback(void *)
void(* uq_free_fn_t)(void *data)
void(* uq_callback_t)(void *data)
QList< struct waiting_queue_data * > waitq_list
QPair< uq_callback_t, struct update_queue_data * > updatePair
QHash< int, waitq_list * > waitingQueue
void real_players_dialog_update(void *unused)
Update all information in the player list dialog.
void units_view_dialog_update(void *unused)
Update the units view.