Crossfire Server, Branch 1.12  R12190
Functions
info.c File Reference

Basic client output functions. More...

#include <global.h>
#include <sproto.h>
#include <stdarg.h>
#include <spells.h>
#include <skills.h>
Include dependency graph for info.c:

Go to the source code of this file.

Functions

static void check_output_buffers (const object *pl, const char *buf)
 Sends message to player through output buffers.
void draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
 Sends message to player(s).
void draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
 Sends message to player(s).
void draw_magic_map (object *pl)
 Creates and sends magic map to player.
static void esrv_print_ext_msg (socket_struct *ns, int color, uint8 type, uint8 subtype, const char *message)
 Draws an extended message on the client.
static void esrv_print_msg (socket_struct *ns, int color, const char *str)
 Draws a normal message on the client.
void ext_info_map (int color, const mapstruct *map, uint8 type, uint8 subtype, const char *str1, const char *str2)
 Writes to everyone on the specified map.
void ext_info_map_except (int color, const mapstruct *map, const object *op, uint8 type, uint8 subtype, const char *str1, const char *str2)
 Writes to everyone on the map *except *op.
void ext_info_map_except2 (int color, const mapstruct *map, const object *op1, const object *op2, int type, int subtype, const char *str1, const char *str2)
 Writes to everyone on the map except op1 and op2.
void flush_output_element (const object *pl, Output_Buf *outputs)
 Prints out the contents of specified buffer structures, and clears the string.
void magic_mapping_mark (object *pl, char *map_mark, int strength)
 Creates magic map for player.
static void magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py)
 Helper for magic map creation.
static void print_message (int colr, const object *pl, const char *tmp)
 Frontend for esrv_print_msg.
void rangetostring (const object *pl, char *obuf, size_t len)
 Get player's current range attack in obuf.
void set_title (const object *pl, char *buf, size_t len)
 Sets player title.

Detailed Description

Basic client output functions.

Date:
2003-12-02

This file implements some of the simpler output functions to the client. Basically, things like sending text strings along

Definition in file info.c.


Function Documentation

static void check_output_buffers ( const object *  pl,
const char *  buf 
) [static]

Sends message to player through output buffers.

Parameters:
plplayer to send message
bufmessage to send

If player's output_count is 1, sends message directly.

Else checks output buffers for specified message.

If found, checks if message should be sent now.

If message not already in buffers, flushes olders buffer, and adds message to queue.

Definition at line 138 of file info.c.

References add_string(), flush_output_element(), free_string(), NDI_BLACK, NUM_OUTPUT_BUFS, print_message(), and pticks.

Referenced by draw_ext_info().

Here is the call graph for this function:

Here is the caller graph for this function:

void draw_ext_info ( int  flags,
int  pri,
const object *  pl,
uint8  type,
uint8  subtype,
const char *  message,
const char *  oldmessage 
)

Sends message to player(s).

Those are dummy functions defined to resolve all symboles.

Parameters:
flagsVarious flags - mostly color, plus a few specials.
priPriority. It is a little odd - the lower the value, the more important it is. Thus, 0 gets sent no matter what. Otherwise, the value must be less than the listening level that the player has set. Unfortunately, there is no clear guideline on what each level does what.
plCan be passed as NULL - in fact, this will be done if NDI_ALL is set in the flags.

If message is black, and not NDI_UNIQUE, gets sent through output buffers. If the client supports the new readables, this is sent to the client without processing in the output buffers.

Parameters:
typeThe type MSG_TYPE for the type of message.
subtypeThe type MSG_TYPE for the type of message.
messageThe message to send for clients that support draw_ext_info.
oldmessageis for clients that do not support it. oldmessage can be NULL, in which case this function will strip out the tags of message.

Definition at line 198 of file info.c.

References check_output_buffers(), CLIENT_SUPPORT_READABLES, draw_ext_info(), esrv_print_ext_msg(), first_player, FLAG_WIZ, llevError, LOG(), NDI_ALL, NDI_ALL_DMS, NDI_BLACK, NDI_COLOR_MASK, NDI_UNIQUE, pl::next, pl::ob, PLAYER, print_message(), QUERY_FLAG, strdup_local(), and strip_media_tag().

Here is the call graph for this function:

void draw_ext_info_format ( int  flags,
int  pri,
const object *  pl,
uint8  type,
uint8  subtype,
const char *  new_format,
const char *  old_format,
  ... 
)

Sends message to player(s).

This function is the same as draw_ext_info, but takes varargs format. Otherwise, the meaning of all the fields is the same. This is perhaps not the most efficient as we do vsnprintf on both the old and newbuf, but it simplifies the code greatly since we can just call draw_ext_info. Also, hopefully at some point, need for old_format will go away.

Parameters:
flagsVarious flags - mostly color, plus a few specials.
priPriority. It is a little odd - the lower the value, the more important it is. Thus, 0 gets sent no matter what. Otherwise, the value must be less than the listening level that the player has set. Unfortunately, there is no clear guideline on what each level does what.
plCan be passed as NULL - in fact, this will be done if NDI_ALL is set in the flags.

If message is black, and not NDI_UNIQUE, gets sent through output buffers. If the client supports the new readables, this is sent to the client without processing in the output buffers.

Parameters:
typeThe type MSG_TYPE for the type of message.
subtypeThe type MSG_TYPE for the type of message.
new_format
old_format

Definition at line 286 of file info.c.

References draw_ext_info(), HUGE_BUF, and vsnprintf.

Here is the call graph for this function:

void draw_magic_map ( object *  pl)

Creates and sends magic map to player.

The following function is a lot messier than it really should be, but there is no real easy solution.

Mark Wedel

Definition at line 542 of file info.c.

References FACE_FLOOR, llevError, LOG(), MAGIC_MAP_HALF, MAGIC_MAP_SIZE, magic_mapping_mark(), MAP_WIDTH, MAX, MIN, PLAYER, Send_With_Handling(), SockList_AddChar(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

static void esrv_print_ext_msg ( socket_struct ns,
int  color,
uint8  type,
uint8  subtype,
const char *  message 
) [static]

Draws an extended message on the client.

ns the socket to send message to color color informations (used mainly if client does not support message type) type, subtype type and subtype of text message intro Intro message to send with main message if client does not support the message type message The main message

Definition at line 69 of file info.c.

References Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().

Referenced by draw_ext_info().

Here is the call graph for this function:

Here is the caller graph for this function:

static void esrv_print_msg ( socket_struct ns,
int  color,
const char *  str 
) [static]

Draws a normal message on the client.

It is pretty much the same thing as the draw_info above, but takes a color parameter. the esrv_drawinfo functions should probably be replaced with this, just using black as the color.

Definition at line 51 of file info.c.

References Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().

Referenced by print_message().

Here is the call graph for this function:

Here is the caller graph for this function:

void ext_info_map ( int  color,
const mapstruct map,
uint8  type,
uint8  subtype,
const char *  str1,
const char *  str2 
)

Writes to everyone on the specified map.

Definition at line 306 of file info.c.

References draw_ext_info(), first_player, pl::next, and pl::ob.

Here is the call graph for this function:

void ext_info_map_except ( int  color,
const mapstruct map,
const object *  op,
uint8  type,
uint8  subtype,
const char *  str1,
const char *  str2 
)

Writes to everyone on the map *except *op.

This is useful for emotions.

Definition at line 318 of file info.c.

References draw_ext_info(), first_player, pl::next, and pl::ob.

Referenced by basic_emote(), and command_cointoss().

Here is the call graph for this function:

Here is the caller graph for this function:

void ext_info_map_except2 ( int  color,
const mapstruct map,
const object *  op1,
const object *  op2,
int  type,
int  subtype,
const char *  str1,
const char *  str2 
)

Writes to everyone on the map except op1 and op2.

Definition at line 330 of file info.c.

References draw_ext_info(), first_player, pl::next, and pl::ob.

Referenced by basic_emote().

Here is the call graph for this function:

Here is the caller graph for this function:

void flush_output_element ( const object *  pl,
Output_Buf outputs 
)

Prints out the contents of specified buffer structures, and clears the string.

Definition at line 108 of file info.c.

References Output_Buf::buf, Output_Buf::count, Output_Buf::first_update, free_string(), MAX_BUF, NDI_BLACK, print_message(), and snprintf().

Referenced by check_output_buffers(), and do_some_living().

Here is the call graph for this function:

Here is the caller graph for this function:

void magic_mapping_mark ( object *  pl,
char *  map_mark,
int  strength 
)

Creates magic map for player.

Note: For improved magic mapping display, the space that blocks the view is now marked with value 2. Any dependencies of map_mark being nonzero have been changed to check for 1. Also, since map_mark is a char value, putting 2 in should cause no problems.

This function examines the map the player is on, and determines what is visible. 2 is set for walls or objects that blocks view. 1 is for open spaces. map_mark should already have been initialized to zero before this is called. strength is an initial strength*2 rectangular area that we automatically see in/penetrate through.

Definition at line 497 of file info.c.

References blank_face, FACE_FLOOR, FACE_WALL, GET_MAP_FACE_OBJ, get_map_flags(), MAGIC_MAP_HALF, MAGIC_MAP_SIZE, magic_mapping_mark_recursive(), new_face_struct::magicmap, MAP_LAYERS, P_BLOCKSVIEW, and P_OUT_OF_MAP.

Referenced by draw_magic_map().

Here is the call graph for this function:

Here is the caller graph for this function:

static void magic_mapping_mark_recursive ( object *  pl,
char *  map_mark,
int  px,
int  py 
) [static]

Helper for magic map creation.

Takes a player, the map_mark array and an x and y starting position. pl is the player. px, py are offsets from the player.

This function examines all the adjacant spaces next to px, py. It updates the map_mark arrow with the color and high bits set for various code values.

Definition at line 434 of file info.c.

References blank_face, FABS, FACE_FLOOR, FACE_WALL, GET_MAP_FACE_OBJ, get_map_flags(), MAGIC_MAP_HALF, MAGIC_MAP_SIZE, new_face_struct::magicmap, MAP_LAYERS, P_BLOCKSVIEW, and P_OUT_OF_MAP.

Referenced by magic_mapping_mark().

Here is the call graph for this function:

Here is the caller graph for this function:

static void print_message ( int  colr,
const object *  pl,
const char *  tmp 
) [static]

Frontend for esrv_print_msg.

Parameters:
colrmessage color
plplayer to send to. Can be NULL
tmpmessage to send. Can be NULL

If pl is NULL or without contr set, writes message to log.

Else sends message to player via esrv_print_msg

Definition at line 89 of file info.c.

References esrv_print_msg(), logfile, and PLAYER.

Referenced by check_output_buffers(), draw_ext_info(), and flush_output_element().

Here is the call graph for this function:

Here is the caller graph for this function:

void rangetostring ( const object *  pl,
char *  obuf,
size_t  len 
)

Get player's current range attack in obuf.

Definition at line 343 of file info.c.

References BOW, Settings::casting_time, FLAG_APPLIED, MAX_BUF, bmappair::name, query_base_name(), QUERY_FLAG, range_bow, range_builder, range_golem, range_magic, range_misc, range_none, range_skill, settings, snprintf(), and TRUE.

Referenced by esrv_update_stats().

Here is the call graph for this function:

Here is the caller graph for this function:

void set_title ( const object *  pl,
char *  buf,
size_t  len 
)

Sets player title.

Definition at line 415 of file info.c.

References snprintf().

Referenced by esrv_update_stats().

Here is the call graph for this function:

Here is the caller graph for this function: