Crossfire Server, Trunk
|
#include "global.h"
#include <stdarg.h>
#include <string.h>
#include "skills.h"
#include "spells.h"
#include "sproto.h"
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) |
Basic client output functions.
This file implements some of the simpler output functions to the client. Basically, things like sending text strings along
Definition in file info.cpp.
|
static |
Fill a socket buffer with an extended message.
sl | Buffer to write to, will be reinitialized. |
color | Color informations (used mainly if client does not support message type). |
type | The type of text message. |
subtype | The subtype of text message. |
message | The 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().
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).
flags | Various 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. |
pri | Priority. 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. |
pl | Who 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. |
type | The type MSG_TYPE for the type of message. |
subtype | The subtype of the message. |
message | The 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().
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.
flags | Various flags - mostly color, plus a few specials. |
pri | Priority. 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. |
pl | Can be passed as NULL - in fact, this will be done if NDI_ALL is set in the flags. |
type | The type MSG_TYPE for the type of message. |
subtype | The type MSG_TYPE for the subtype of message. |
format | The 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.
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().
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
color | The color of the message |
map | The map where the players receiving the message are located |
type | The message type |
subtype | The message subtype |
str1 | The 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.
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.
color | The color of the message |
map | The map where the players receiving the message are located |
op | The player object to skip sending the message to on the map |
type | The message type |
subtype | The message subtype |
str1 | The 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().
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
color | The message color |
map | The map where the players receiving the message are located |
op1 | The first player object to skip sending the message to |
op2 | The second player object to skip sending the message to |
type | The message type |
subtype | The message subtype |
str1 | The 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().
void magic_mapping_mark | ( | object * | pl, |
char * | map_mark, | ||
int | strength | ||
) |
Creates magic map for player.
pl | The player making the magic map |
map_mark | Holds flags for each tile analyzed. Should have been initialized to zero before this function is called. |
strength | An 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().
|
static |
Helper for magic map creation.
Takes a player, the map_mark array and an x and y starting position.
pl | The player creating the magic map. |
map_mark | Holds flags for each tile analyzed |
px | The x offset from the player to start calculations |
py | The 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().
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.
ns | The socket to send message to |
color | Color informations (used mainly if client does not support message type) |
type | The type of text message |
subtype | The subtype of text message |
message | The 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().
void rangetostring | ( | const object * | pl, |
char * | obuf, | ||
size_t | len | ||
) |
Get player's current range attack in obuf.
pl | The player who is being evaluated |
obuf | The buffer for the range attack string |
len | The 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().
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().