Crossfire Client, Trunk  R18666
Functions
/home/leaf/crossfire/client/trunk/common/external.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void SoundCmd (unsigned char *data, int len)
void Sound2Cmd (unsigned char *data, int len)
void MusicCmd (const char *data, int len)
void resize_map_window (int x, int y)
void display_map_newmap (void)
void display_map_addbelow (long x, long y, long face)
void display_map_startupdate (void)
void display_map_doneupdate (int redraw, int notice)
int display_mapscroll (int dx, int dy)
void draw_magic_map (void)
void draw_prompt (const char *str)
void draw_ext_info (int orig_color, int type, int subtype, const char *message)
void x_set_echo (void)
void set_scroll (const char *s)
void set_autorepeat (const char *s)
void menu_clear (void)
int get_info_width (void)
void draw_stats (int redraw)
void draw_message_window (int redraw)
void set_weight_limit (uint32 wlim)
int display_willcache (void)
int create_and_rescale_image_from_data (Cache_Entry *ce, int pixmap_num, uint8 *rgba_data, int width, int height)
uint8png_to_data (uint8 *data, int len, uint32 *width, uint32 *height)
int associate_cache_entry (Cache_Entry *ce, int pixnum)
void image_update_download_status (int start, int end, int total)
void get_map_image_size (int face, uint8 *w, uint8 *h)
void addsmooth (uint16 face, uint16 smooth_face)
void open_container (item *op)
void close_container (item *op)
void set_show_icon (const char *s)
void set_show_weight (const char *s)
void bind_key (const char *params)
void unbind_key (const char *params)
void save_winpos (void)
void save_defaults (void)
void command_show (const char *params)
void client_tick (uint32 tick)
void cleanup_connection (void)
void client_pickup (uint32 pickup)
void start_login (int method)
void hide_all_login_windows (void)
void account_login_failure (char *message)
void account_creation_failure (char *message)
void account_add_character_failure (char *message)
void account_change_password_failure (char *message)
void create_new_character_failure (char *message)
void choose_character_init (void)
void update_character_choose (const char *name, const char *class, const char *race, const char *face, const char *party, const char *map, int level, int faceno)
void update_login_info (int type)
void new_char_window_update_info ()
void starting_map_update_info ()

Detailed Description

Contains external calls that the common area makes callbacks to. This was really a quick hack done to allow some separation. Really, these should be set via callbacks that the client can make to the library. Many of these probably should never really be callbacks in any case, or be more general.

Definition in file external.h.


Function Documentation

void account_add_character_failure ( char *  message)

Handles a failure from the server - pretty basic - just throw up the message and let the user try again. This is a response to the 'failure accountaddplayer' command. Calling this account_add_character_failure may be a little bit of a misnomer, but all the other routines in this area refer to character, not player.

Parameters:
messageMessage to display. Unlike other messages, the first word of this message should be an integer, which denotes if using the 'force' option would allow the user to override this.

Definition at line 320 of file account.c.

Here is the caller graph for this function:

void account_change_password_failure ( char *  message)

Definition at line 1311 of file account.c.

Here is the caller graph for this function:

void account_creation_failure ( char *  message)

Handles a failure from the server - pretty basic - just throw up the message and let the user try again.

Parameters:
message

Definition at line 802 of file account.c.

Here is the caller graph for this function:

void account_login_failure ( char *  message)

Handles a failure from the server - pretty basic - just throw up the message and let the user try again.

Parameters:
message

Definition at line 991 of file account.c.

Here is the caller graph for this function:

void addsmooth ( uint16  face,
uint16  smooth_face 
)

Referenced from common/commands.c

Parameters:
face
smooth_face

Definition at line 426 of file image.c.

Here is the caller graph for this function:

int associate_cache_entry ( Cache_Entry ce,
int  pixnum 
)

This functions associates image_data in the cache entry with the specific pixmap number. Currently, there is no failure condition, but there is the potential that in the future, we want to more closely look at the data and if it isn't valid, return the failure code.

Returns:
0 on success, -1 on failure.

Definition at line 439 of file image.c.

Here is the caller graph for this function:

void bind_key ( const char *  params)
void choose_character_init ( void  )

Called when we get the accountplayers command from the server (indirectly via AccountPlayersCmd). This tells us to wipe any data from the treeview, but also hide any other windows and make the choose_character_window visible.

Definition at line 471 of file account.c.

Here is the caller graph for this function:

void cleanup_connection ( void  )

Called from disconnect command - that closes the socket - we just need to do the gtk cleanup.

Definition at line 167 of file main.c.

void client_pickup ( uint32  pickup)

We get pickup information from server, update our status.

Definition at line 643 of file pickup.c.

Here is the caller graph for this function:

void client_tick ( uint32  tick)

X11 client doesn't care about this

Definition at line 139 of file main.c.

Here is the caller graph for this function:

void close_container ( item op)

Open and close_container are now no-ops - since these are now drawn inline as treestores, we don't need to update what we are drawing were. and since the activation of a container will cause the list to be redrawn, don't need to worry about making an explicit call here.

Parameters:
op

Definition at line 567 of file inventory.c.

Here is the caller graph for this function:

void command_show ( const char *  params)
Parameters:
params

Definition at line 585 of file inventory.c.

int create_and_rescale_image_from_data ( Cache_Entry ce,
int  pixmap_num,
uint8 rgba_data,
int  width,
int  height 
)

Takes the pixmap to put the data into, as well as the rgba data (ie, already loaded with png_to_data). Scales and stores the relevant data into the pixmap structure.

Parameters:
cecan be NULL
pixmap_num
rgba_data
width
height
Returns:
1 on failure.

Definition at line 297 of file image.c.

Here is the caller graph for this function:

void create_new_character_failure ( char *  message)

Pop up a dialog window with the error from the server. Since both v1 and v2 character creation are supported, either the new_character_window or the create_character_window may be up, so we can not easily display an in window message - a pop up is probably better, but it will also work no matter what window is up.

Parameters:
messagemessage - this comes from the server.

Definition at line 167 of file account.c.

Here is the caller graph for this function:

void display_map_addbelow ( long  x,
long  y,
long  face 
)
void display_map_doneupdate ( int  redraw,
int  notice 
)

This is called after the map has been all digested. this should perhaps be removed, and left to being done from from the main event loop.

Parameters:
redrawIf set, force redraw of all tiles.
noticeIf set, another call will follow soon.

Definition at line 771 of file map.c.

Here is the caller graph for this function:

void display_map_newmap ( void  )

The player has changed maps, so any info we have (for fog of war) is bogus, so clear out all that old info.

Definition at line 563 of file map.c.

Here is the caller graph for this function:

void display_map_startupdate ( void  )

This isn't used - it is basically a prequel - we know we got a map command from the server, but have digested it all yet. This can be useful if there is info we know we need to store away or the like before it is destroyed, but there isn't anything like that for the gtk client.

Definition at line 760 of file map.c.

Here is the caller graph for this function:

int display_mapscroll ( int  dx,
int  dy 
)
Parameters:
dx
dy

Definition at line 231 of file map.c.

Here is the caller graph for this function:

int display_willcache ( void  )
void draw_ext_info ( int  orig_color,
int  type,
int  subtype,
const char *  message 
)

A message processor that accepts messages along with meta information color and type. The message type and subtype are analyzed to select font and other text attributes. All gtk-v2 client messages pass through this processor before being output. Before addition of the output buffering feature, this was the message callback function. It is a separate function so that it can be called both by the callback, and but buffer maintenance functions.

Client-sourced messages generally should be passed directly to this handler instead of to the callback. This will save some overhead as the callback implements a system that coalesces duplicate messages - a feature that is not really applicable to most messages that do not come from the server.

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.

< When 0, the type is valid and may be used to pick the panel routing, otherwise the message can only go to the main message pane.

Definition at line 894 of file info.c.

Here is the caller graph for this function:

void draw_magic_map ( void  )

Draws the magic map - basically, it is just a simple encoding of space X is color C.

Definition at line 51 of file magicmap.c.

Here is the caller graph for this function:

void draw_message_window ( int  redraw)

Updates the stats pane - hp, sp, etc labels

Parameters:
redraw

Definition at line 423 of file stats.c.

Here is the caller graph for this function:

void draw_stats ( int  redraw)

Draws the stats window. If redraw is true, it means we need to redraw the entire thing, and not just do an updated

Definition at line 507 of file stats.c.

Here is the caller graph for this function:

int get_info_width ( void  )

This is used by the common help system to determine when to wrap. Should be able to get width of window, and divide by character width - however, still not perfect if we are using a variable width font. Actually, GTK can do word wrapping for us, so maybe the real fix is to have it to the word wrapping and just run a sufficiently large value.

Returns:
The width of the info window in characters.
Todo:
Configure automatic line wrap in message panels and get rid of the hardcoded 40-character wrap.

Definition at line 1309 of file info.c.

Here is the caller graph for this function:

void get_map_image_size ( int  face,
uint8 w,
uint8 h 
)
Parameters:
face
w
h

Definition at line 533 of file image.c.

void hide_all_login_windows ( void  )

Hides all the login related windows. This is needed in case the client loses the connection to the server (either through player going to client/disconnect or network failure). get_metaserver() calls this, as well as AddMeSuccess

Definition at line 116 of file account.c.

Here is the caller graph for this function:

void image_update_download_status ( int  start,
int  end,
int  total 
)

Draws a status bar showing where we our in terms of downloading all the image data. A few hacks: If start is 1, this is the first batch, so it means we need to create the appropriate status window. If start = end = total, it means were finished, so destroy the gui element.

Parameters:
startThe start value just sent to the server.
end
totalThe total number of images.

Definition at line 486 of file image.c.

Here is the caller graph for this function:

void menu_clear ( void  )

Clears all the message panels. It is not clear why someone would use it, but is called from the common area, and so is supported here.

Definition at line 1267 of file info.c.

void MusicCmd ( const char *  data,
int  len 
)

Parse the data contained by a music command coming from the server and pass the name along to cfsndserv as a quoted string.

Parameters:
dataData provided following the music command from the server that hints what kind of music should play. NONE is an indication that music should stop playing.
lenLength of the string describing the music to play.

Format of the music command received in data:

 music {string}
 

cfsndserv recognizes music commands by seeing the quoted string as the first item on the command line.

Definition at line 245 of file sound.c.

We have gotten some new information from the server, so we need to update the information - race/class choices or stat points/min stat/max stat information.

Definition at line 646 of file create_char.c.

Here is the call graph for this function:

void open_container ( item op)
Parameters:
op

Definition at line 576 of file inventory.c.

Here is the caller graph for this function:

uint8* png_to_data ( uint8 data,
int  len,
uint32 width,
uint32 height 
)
Parameters:
*data
len
*width
*height

Definition at line 80 of file png.c.

Here is the caller graph for this function:

void resize_map_window ( int  x,
int  y 
)

Resize_map_window is a NOOP for the time being - not sure if it will in fact need to do something, since there are scrollbars for the map window now. Note - this is note a window resize request, but rather process the size (in spaces) of the map - is received from server.

Definition at line 574 of file map.c.

Here is the caller graph for this function:

void save_defaults ( void  )

This function saves user settings chosen using the configuration popup dialog.

Definition at line 443 of file config.c.

Here is the caller graph for this function:

void save_winpos ( void  )

Handles saving of the window positions when the Client | Save Window Position menu item is executed. All hpaned and vpaned widget settings have the information required, and the code automatically works for Glade XML layouts that follow the glade-2's default widget naming convention.

Definition at line 1069 of file config.c.

Here is the caller graph for this function:

void set_autorepeat ( const char *  s)

A stub function that does nothing. These are callbacks used by the common code, but they are not implemented in GTK, either because it makes no sense (set_scroll for example), or because it may not be technically possible to do so if we limit ourselves to proper GTK2 code (Eg, don't mess with the internals of X or platform specific issues)

Parameters:
s

Definition at line 1297 of file info.c.

void set_scroll ( const char *  s)

A stub function that does nothing. These are callbacks used by the common code, but they are not implemented in GTK, either because it makes no sense (set_scroll for example), or because it may not be technically possible to do so if we limit ourselves to proper GTK2 code (Eg, don't mess with the internals of X or platform specific issues)

Parameters:
s

Definition at line 1284 of file info.c.

void set_show_icon ( const char *  s)
Parameters:
s

Definition at line 547 of file inventory.c.

void set_show_weight ( const char *  s)
Parameters:
s

Definition at line 555 of file inventory.c.

void set_weight_limit ( uint32  wlim)

No reason to divide by 1000 everytime we do the display, so do it once and store it here.

Parameters:
wlim

Definition at line 617 of file inventory.c.

Here is the caller graph for this function:

void Sound2Cmd ( unsigned char *  data,
int  len 
)

Parse the data contained by a sound2 command coming from the server and handle playing the specified sound. See server doc/Developers/sound for details.

Parameters:
dataData provided following the sound2 command from the server.
lenLength of the sound2 command data.

Format of the sound2 command recieved in data:

 sound2 {x}{y}{dir}{volume}{type}{len_sound}{sound}{len_source}{source}
         b  b  b    b       b     b          str    b           str
 

Definition at line 163 of file sound.c.

void SoundCmd ( unsigned char *  data,
int  len 
)
void start_login ( int  method)

Starts the login process. If not already done, gets widgets, sets up callboacks, etc. This is at the end of the file so all the callbacks are defined before this function - in that way, we do not need forward declarations. This is called from SetupCmd in common/commands.c

Parameters:
methodLogin method that the server suppots.

Definition at line 1457 of file account.c.

Here is the caller graph for this function:

We have gotten starting map information from the server - now update the combo boxes.

Definition at line 767 of file create_char.c.

Here is the call graph for this function:

void update_character_choose ( const char *  name,
const char *  class,
const char *  race,
const char *  face,
const char *  party,
const char *  map,
int  level,
int  faceno 
)

This gets data and adds it to the list store. This is called from AccountPlayersCmd and data is from the accountplayers protocol command. The parameters are data to add to the list store.

Parameters:
name
class
race
face
party
map
level
faceno

Definition at line 610 of file account.c.

Here is the caller graph for this function:

void update_login_info ( int  type)

This is called from ReplyInfoCmd when it gets a response from news/motd/rules. It is very possible that the window will get displayed before we got a reply response, so this tells the client to update it.

Parameters:
typeWhat data just got updated - text string of motd/news/rules

Definition at line 1372 of file account.c.

Here is the caller graph for this function: