Crossfire Client, Trunk  R20693
GTK V2 client output count/sync functions.


void info_buffer_flush (const int id)
void info_buffer_init (void)
void info_buffer_tick (void)

GTK V2 Message Control System.

Supports a client-side implementation of what used to be provided by the server output-count and output-sync commands. These defines presently control the way the system works. The hardcoded values here are temporary and shall give way to client commands and/or a GUI method of configuring the system. Turn off the output count/sync by setting MESSAGE_COUNT_MAX to 1. It should be safe to experiment with most values as long as none of them are set less than 1, and as long as the two buffer sizes are set to reasonable values (buffer sizes include the terminating null character).

static void message_callback (int orig_color, int type, int subtype, char *message)

Detailed Description

Function Documentation

◆ info_buffer_flush()

void info_buffer_flush ( const int  id)

Handles message buffer flushes, and, as needed, displays the text. Flushed buffers have their count set to -1. On flush, the message text is output only when the message count is greater than zero. If the message text is displayed, and if the count is greater than one, it is prepended to the message in the form "N * times ". This function is called whenever a message must be ejected from the output count/sync system buffers. Note that the message details are preserved when the buffer is flushed. This allows the buffer contents to be re-used if another message with the same text comes in before the buffer is re-used for a different message.

idThe message control buffer to flush (0 - MESSAGE_BUFFER_COUNT).

Definition at line 1037 of file info.c.

Referenced by draw_ext_info(), and message_callback().

+ Here is the caller graph for this function:

◆ info_buffer_init()

void info_buffer_init ( void  )

Output count/sync message buffer initialization to set all buffers empty. Called only once at client start from info_init(), the function initializes all message buffers to the empty state (count == -1). At a minimum, age, count, and message should be initialized. Type, subtype, and orig_color are also set just for an extra measure of safety.

Definition at line 1010 of file info.c.

Referenced by draw_ext_info().

+ Here is the caller graph for this function:

◆ info_buffer_tick()

void info_buffer_tick ( void  )

Output count/sync buffer maintainer adds buffer time and output messages. For every tick, age active messages so it eventually gets displayed. If the data in an buffer reaches the maximum permissible age or message occurance count, it is ejected and displayed. Inactive buffers are also aged so that the oldest empty buffer is used first when a new message comes in.

Definition at line 1086 of file info.c.

Referenced by client_tick().

+ Here is the caller graph for this function:

◆ message_callback()

static void message_callback ( int  orig_color,
int  type,
int  subtype,
char *  message 

A callback to accept messages along with meta information color and type. Unlike the GTK V1 client, we don't do anything tricky like popups with different message types, but the output-count/sync features do consider message type, etc. To allow user-defined buffering rules all messages need to pass through a common processor. This callback is the interface for the output buffering. Even if output buffering could be bypassed, it is still necessary to pass messages through a common interface to handle style, theme, and display panel configuration. This callback routes all messages to the appropriate handler for pre-display processing (draw_ext_info()).

It is recommended that client-sourced messages be passed directly to draw_ext_info() instead of through the callback to avoid unnecessary processing. MSG_TYPE_CLIENT messages are deliberately not buffered here because they are generally unique, adminstrative messages that should not be delayed.

orig_colorSuggested text color that type/subtype can over-ride.
typeMessage type. See MSG_TYPE definitions in newclient.h.
subtypeMessage subtype. See MSG_TYPE_*_* values in newclient.h.
messageThe message text to display.

Definition at line 1144 of file info.c.

References info_buffer_t::age, info_buffer_t::count, buffer_control_t::count, draw_ext_info(), info_buffer, info_buffer_flush(), LOG(), LOG_DEBUG, LOG_ERROR, menu_clear(), MESSAGE_BUFFER_COUNT, NUM_TEXT_VIEWS, info_buffer_t::orig_color, info_buffer_t::subtype, and info_buffer_t::type.

+ Here is the call graph for this function: