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

Functions

void info_buffer_flush (const int id)
 
void info_buffer_init (void)
 
void info_buffer_tick (void)
 
static void launch_mapedit (char *path)
 

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.

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

Definition at line 1020 of file info.c.

References info_buffer_t::count, COUNT_BUFFER_SIZE, draw_ext_info(), info_buffer, and MESSAGE_BUFFER_SIZE.

Referenced by info_buffer_tick(), and message_callback().

Here is the call graph for this function:
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 993 of file info.c.

References info_buffer_t::age, info_buffer_t::count, info_buffer, info_buffer_t::message, MESSAGE_BUFFER_COUNT, info_buffer_t::orig_color, info_buffer_t::subtype, and info_buffer_t::type.

Referenced by info_init().

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 1069 of file info.c.

References info_buffer_t::age, buffer_control, info_buffer_t::count, buffer_control_t::count, info_buffer, info_buffer_flush(), MESSAGE_BUFFER_COUNT, buffer_parameter_t::state, and buffer_control_t::timer.

Referenced by client_tick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ launch_mapedit()

static void launch_mapedit ( char *  path)
static

Definition at line 1103 of file info.c.

References draw_ext_info(), LOG(), LOG_ERROR, LOG_INFO, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, and NDI_RED.

Referenced by message_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ message_callback()

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

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.

Parameters
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, arm_mapedit, info_buffer_t::count, draw_ext_info(), info_buffer, info_buffer_flush(), launch_mapedit(), LOG(), LOG_DEBUG, LOG_ERROR, LOG_INFO, MESSAGE_BUFFER_COUNT, MESSAGE_BUFFER_SIZE, MSG_TYPE_LAST, msgctrl_widgets, NDI_UNIQUE, info_buffer_t::orig_color, info_buffer_t::subtype, and info_buffer_t::type.

Referenced by info_init().

Here is the call graph for this function:
Here is the caller graph for this function: