Crossfire Server, Trunk
info.cpp File Reference
#include "global.h"
#include <stdarg.h>
#include <string.h>
#include "skills.h"
#include "spells.h"
#include "sproto.h"
+ Include dependency graph for info.cpp:

Go to the source code of this file.

Functions

static void do_print_ext (SockList *sl, int color, uint8_t type, uint8_t subtype, const char *message)
 
void draw_ext_info (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
 
void draw_ext_info_format (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
 
void draw_magic_map (object *pl)
 
void ext_info_map (int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1)
 
void ext_info_map_except (int color, const mapstruct *map, const object *op, uint8_t type, uint8_t subtype, const char *str1)
 
void ext_info_map_except2 (int color, const mapstruct *map, const object *op1, const object *op2, int type, int subtype, const char *str1)
 
void magic_mapping_mark (object *pl, char *map_mark, int strength)
 
static void magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py)
 
void print_ext_msg (socket_struct *ns, int color, uint8_t type, uint8_t subtype, const char *message)
 
void rangetostring (const object *pl, char *obuf, size_t len)
 
void set_title (const object *pl, char *buf, size_t len)
 

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.cpp.

Function Documentation

◆ do_print_ext()

static void do_print_ext ( SockList sl,
int  color,
uint8_t  type,
uint8_t  subtype,
const char *  message 
)
static

Fill a socket buffer with an extended message.

Parameters
slBuffer to write to, will be reinitialized.
colorColor informations (used mainly if client does not support message type).
typeThe type of text message.
subtypeThe subtype of text message.
messageThe main message.

Definition at line 41 of file info.cpp.

References smoking_pipe::color, diamondslots::message, SockList_AddPrintf(), SockList_Init(), and is_valid_types_gen::type.

Referenced by draw_ext_info(), and print_ext_msg().

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

◆ draw_ext_info()

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

Sends message to player(s).

Parameters
flagsVarious flags - mostly color, plus a few specials. If NDI_ALL or NDI_ALL_DMS is set, pl is ignored and the message is resent to all players or all DMs individually.
priPriority. 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.
plWho to send the message to. pl may be NULL, particularly if flags has NDI_ALL or NDI_DMS set since it is ignored in that case. If NDI_ALL and NDI_DMS are not set, when pl is NULL, nobody gets the message. This is sometimes useful when a function that can be invoked by a player is automatically called by some other mechanism. For example, if a player tries to put something in a container, they should get a message that tells them they cannot put it in an unsuitable container, but when auto-pickup is at work, all containers are tried, even unsuitable ones, and so messages should not be sent to the player.
typeThe type MSG_TYPE for the type of message.
subtypeThe subtype of the message.
messageThe message to send.

Definition at line 97 of file info.cpp.

References do_print_ext(), first_player, FLAG_WIZ, flags, i18n(), llevInfo, LOG(), diamondslots::message, NDI_ALL, NDI_ALL_DMS, NDI_COLOR_MASK, NDI_DELAYED, NDI_NO_TRANSLATE, player::next, player::ob, altar_valkyrie::pl, PLAYER, player_get_delayed_buffer(), print_ext_msg(), QUERY_FLAG, and is_valid_types_gen::type.

Referenced by draw_ext_info_format(), ext_info_map(), ext_info_map_except(), and ext_info_map_except2().

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

◆ draw_ext_info_format()

void draw_ext_info_format ( int  flags,
int  pri,
const object pl,
uint8_t  type,
uint8_t  subtype,
const char *  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.

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.
typeThe type MSG_TYPE for the type of message.
subtypeThe type MSG_TYPE for the subtype of message.
formatThe message to send, with optional format specifiers.

Definition at line 155 of file info.cpp.

References buf, draw_ext_info(), flags, HUGE_BUF, i18n(), llevInfo, LOG(), NDI_ALL, NDI_ALL_DMS, NDI_NO_TRANSLATE, altar_valkyrie::pl, and is_valid_types_gen::type.

+ Here is the call graph for this function:

◆ draw_magic_map()

void draw_magic_map ( object pl)

Creates and sends magic map to player.

@ param pl The player to send the magic map to

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

Mark Wedel

Definition at line 474 of file info.cpp.

References FACE_FLOOR, llevError, LOG(), MAGIC_MAP_HALF, MAGIC_MAP_SIZE, magic_mapping_mark(), MAX, MIN, altar_valkyrie::pl, PLAYER, Send_With_Handling(), SockList_AddChar(), SockList_AddPrintf(), SockList_Init(), SockList_Term(), diamondslots::x, and diamondslots::y.

Referenced by cast_spell().

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

◆ ext_info_map()

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

Writes to everyone on the specified map

Parameters
colorThe color of the message
mapThe map where the players receiving the message are located
typeThe message type
subtypeThe message subtype
str1The message to be sent

Definition at line 195 of file info.cpp.

References smoking_pipe::color, draw_ext_info(), first_player, disinfect::map, altar_valkyrie::pl, and is_valid_types_gen::type.

+ Here is the call graph for this function:

◆ ext_info_map_except()

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

Writes to everyone on the map except *op. This is useful for emotions.

Parameters
colorThe color of the message
mapThe map where the players receiving the message are located
opThe player object to skip sending the message to on the map
typeThe message type
subtypeThe message subtype
str1The message to be sent

Definition at line 219 of file info.cpp.

References smoking_pipe::color, draw_ext_info(), first_player, disinfect::map, give::op, altar_valkyrie::pl, and is_valid_types_gen::type.

Referenced by basic_emote(), command_cointoss(), and monster_communicate().

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

◆ ext_info_map_except2()

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

Writes to everyone on the map except op1 and op2

Parameters
colorThe message color
mapThe map where the players receiving the message are located
op1The first player object to skip sending the message to
op2The second player object to skip sending the message to
typeThe message type
subtypeThe message subtype
str1The message to be sent

Definition at line 245 of file info.cpp.

References smoking_pipe::color, draw_ext_info(), first_player, disinfect::map, altar_valkyrie::pl, and is_valid_types_gen::type.

Referenced by basic_emote().

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

◆ magic_mapping_mark()

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

Creates magic map for player.

Parameters
plThe player making the magic map
map_markHolds flags for each tile analyzed. Should have been initialized to zero before this function is called.
strengthAn initial strength*2 rectangular area that we automatically see in/penetrate through.

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.

Definition at line 427 of file info.cpp.

References blank_face, FACE_FLOOR, FACE_WALL, GET_MAP_FACE_OBJ, get_map_flags(), banquet::l, MAGIC_MAP_HALF, MAGIC_MAP_SIZE, magic_mapping_mark_recursive(), Face::magicmap, MAP_LAYERS, guildjoin::ob, P_BLOCKSVIEW, P_OUT_OF_MAP, altar_valkyrie::pl, diamondslots::x, and diamondslots::y.

Referenced by draw_magic_map().

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

◆ magic_mapping_mark_recursive()

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.

Parameters
plThe player creating the magic map.
map_markHolds flags for each tile analyzed
pxThe x offset from the player to start calculations
pyThe y offset from the player to start calculations

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 359 of file info.cpp.

References blank_face, FABS, FACE_FLOOR, FACE_WALL, GET_MAP_FACE_OBJ, get_map_flags(), banquet::l, MAGIC_MAP_HALF, MAGIC_MAP_SIZE, Face::magicmap, MAP_LAYERS, guildjoin::ob, P_BLOCKSVIEW, P_OUT_OF_MAP, altar_valkyrie::pl, diamondslots::x, and diamondslots::y.

Referenced by magic_mapping_mark().

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

◆ print_ext_msg()

void print_ext_msg ( socket_struct ns,
int  color,
uint8_t  type,
uint8_t  subtype,
const char *  message 
)

Draws an extended message on the client.

Parameters
nsThe socket to send message to
colorColor informations (used mainly if client does not support message type)
typeThe type of text message
subtypeThe subtype of text message
messageThe main message

make this non-static, so other files can use this to send messages to client before player has been added.

Definition at line 62 of file info.cpp.

References smoking_pipe::color, do_print_ext(), diamondslots::message, Send_With_Handling(), SockList_Term(), and is_valid_types_gen::type.

Referenced by add_me_cmd(), and draw_ext_info().

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

◆ rangetostring()

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

Get player's current range attack in obuf.

Parameters
plThe player who is being evaluated
obufThe buffer for the range attack string
lenThe length of the buffer

Definition at line 264 of file info.cpp.

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

Referenced by esrv_update_stats().

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

◆ set_title()

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

Sets player title.

Definition at line 334 of file info.cpp.

References buf, altar_valkyrie::pl, and player_get_title().

Referenced by esrv_update_stats().

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