Crossfire Server, Branch 1.12  R12190
Defines | Functions
item.c File Reference

Client/server logic. More...

#include <global.h>
#include <object.h>
#include <newclient.h>
#include <newserver.h>
#include <sproto.h>
Include dependency graph for item.c:

Go to the source code of this file.

Defines

#define MAXITEMLEN   300
 This is the maximum number of bytes we expect any one item to take up.

Functions

static void add_object_to_socklist (socket_struct *ns, SockList *sl, object *head)
 Used in the send_look to put object head into SockList sl for socket ns.
void apply_cmd (char *buf, int len, player *pl)
 Client wants to apply some object.
void esrv_del_item (player *pl, int tag)
 Tells the client to delete an item.
void esrv_draw_look (object *pl)
 Send the look window.
static object * esrv_get_ob_from_count (object *pl, tag_t count)
 Takes a player and object count (tag) and returns the actual object pointer, or null if it can't be found.
void esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof)
 Move an object to a new location.
void esrv_send_inventory (object *pl, object *op)
 Sends whole inventory.
void esrv_send_item (object *pl, object *op)
 Sends item's info to player.
void esrv_update_item (int flags, object *pl, object *op)
 Updates object *op for player *pl.
void examine_cmd (char *buf, int len, player *pl)
 Client wants to examine some object.
void inscribe_scroll_cmd (char *buf, int len, player *pl)
void lock_item_cmd (uint8 *data, int len, player *pl)
 Client wants to apply some object.
void look_at (object *op, int dx, int dy)
 Prints items on the specified square.
void look_at_cmd (char *buf, int len, player *pl)
 Client wants to look at some object.
void mark_item_cmd (uint8 *data, int len, player *pl)
 Client wants to mark some object.
static unsigned int query_flags (const object *op)
 This is a similar to query_name, but returns flags to be sended to client.

Detailed Description

Client/server logic.

Date:
2003-12-02

This containes item logic for client/server. It doesn't contain the actual commands that send the data, but does contain the logic for what items should be sent.

Definition in file item.c.


Define Documentation

#define MAXITEMLEN   300

This is the maximum number of bytes we expect any one item to take up.

Definition at line 47 of file item.c.

Referenced by esrv_draw_look(), and esrv_send_inventory().


Function Documentation

static void add_object_to_socklist ( socket_struct ns,
SockList sl,
object *  head 
) [static]

Used in the send_look to put object head into SockList sl for socket ns.

Need socket to know if we need to send animation of face to the client.

Definition at line 126 of file item.c.

References socket_struct::anims_sent, esrv_send_animation(), esrv_send_face(), F_NOPICK, FABS, socket_struct::faces_sent, FLAG_ANIMATE, FLAG_CLIENT_SENT, FLAG_NO_PICK, flags, MAX_BUF, NS_FACESENT_FACE, query_base_name(), QUERY_FLAG, query_flags(), SET_FLAG, SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddShort(), and WEIGHT.

Referenced by esrv_draw_look(), esrv_send_inventory(), and esrv_send_item().

Here is the call graph for this function:

Here is the caller graph for this function:

void apply_cmd ( char *  buf,
int  len,
player pl 
)

Client wants to apply some object.

Lets do so.

Definition at line 581 of file item.c.

References esrv_get_ob_from_count(), FLAG_REMOVED, llevDebug, LOG(), socket_struct::look_position, pl::ob, player_apply(), QUERY_FLAG, pl::socket, and socket_struct::update_look.

Here is the call graph for this function:

void esrv_del_item ( player pl,
int  tag 
)

Tells the client to delete an item.

Uses the item command with a -1 location.

Definition at line 507 of file item.c.

References Send_With_Handling(), pl::socket, SockList_AddInt(), SockList_AddString(), SockList_Init(), and SockList_Term().

Here is the call graph for this function:

void esrv_draw_look ( object *  pl)

Send the look window.

Don't need to do animations here This sends all the faces to the client, not just updates. This is because object ordering would otherwise be inconsistent

Definition at line 191 of file item.c.

References add_object_to_socklist(), empty_face, esrv_send_face(), FLAG_IS_FLOOR, FLAG_REMOVED, GET_MAP_OB, llevDebug, LOG(), MAP_IN_MEMORY, MAX, MAX_BUF, MAXITEMLEN, MIN, NS_FACESENT_FACE, new_face_struct::number, out_of_map(), QUERY_FLAG, Send_With_Handling(), snprintf(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), and SockList_Term().

Referenced by do_server().

Here is the call graph for this function:

Here is the caller graph for this function:

static object* esrv_get_ob_from_count ( object *  pl,
tag_t  count 
) [static]

Takes a player and object count (tag) and returns the actual object pointer, or null if it can't be found.

Definition at line 529 of file item.c.

References CONTAINER, and GET_MAP_OB.

Referenced by apply_cmd(), esrv_move_object(), examine_cmd(), inscribe_scroll_cmd(), lock_item_cmd(), and mark_item_cmd().

Here is the caller graph for this function:

void esrv_move_object ( object *  pl,
tag_t  to,
tag_t  tag,
long  nrof 
)

Move an object to a new location.

Definition at line 773 of file item.c.

References can_pick(), CONTAINER, drop_object(), esrv_get_ob_from_count(), esrv_update_item(), FLAG_APPLIED, llevDebug, LOG(), pick_up(), put_object_in_sack(), QUERY_FLAG, sack_can_hold(), transport_can_hold(), and UPD_WEIGHT.

Referenced by move_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

void esrv_send_inventory ( object *  pl,
object *  op 
)

Sends whole inventory.

Definition at line 307 of file item.c.

References add_object_to_socklist(), MAXITEMLEN, Send_With_Handling(), SockList_AddInt(), SockList_AddPrintf(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), and SockList_Term().

Referenced by apply_container(), check_login(), command_possess(), key_change_class(), player_changer_type_process(), save_player(), and use_alchemy().

Here is the call graph for this function:

Here is the caller graph for this function:

void esrv_send_item ( object *  pl,
object *  op 
)

Sends item's info to player.

Definition at line 470 of file item.c.

References add_object_to_socklist(), FLAG_CLIENT_SENT, Send_With_Handling(), SET_FLAG, SockList_AddInt(), SockList_AddString(), SockList_Init(), and SockList_Term().

Here is the call graph for this function:

void esrv_update_item ( int  flags,
object *  pl,
object *  op 
)

Updates object *op for player *pl.

flags is a list of values to update to the client (as defined in newclient.h - might as well use the same value both places.

Definition at line 359 of file item.c.

References esrv_send_face(), FABS, FLAG_ANIMATE, FLAG_CLIENT_SENT, FLAG_NO_PICK, llevDebug, LOG(), MAX_BUF, NS_FACESENT_FACE, query_base_name(), QUERY_FLAG, query_flags(), Send_With_Handling(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), UPD_ANIM, UPD_ANIMSPEED, UPD_FACE, UPD_FLAGS, UPD_LOCATION, UPD_NAME, UPD_NROF, UPD_WEIGHT, and WEIGHT.

Here is the call graph for this function:

void examine_cmd ( char *  buf,
int  len,
player pl 
)

Client wants to examine some object.

So lets do so.

Definition at line 562 of file item.c.

References esrv_get_ob_from_count(), examine(), llevDebug, LOG(), and pl::ob.

Here is the call graph for this function:

void inscribe_scroll_cmd ( char *  buf,
int  len,
player pl 
)
void lock_item_cmd ( uint8 data,
int  len,
player pl 
)

Client wants to apply some object.

Lets do so.

Definition at line 615 of file item.c.

References CLEAR_FLAG, draw_ext_info(), esrv_get_ob_from_count(), esrv_update_item(), FLAG_INV_LOCKED, GetInt_String(), llevDebug, LOG(), merge_ob(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, pl::ob, SET_FLAG, and UPD_FLAGS.

Here is the call graph for this function:

void look_at ( object *  op,
int  dx,
int  dy 
)

Prints items on the specified square.

[ removed EARTHWALL check and added check for containers inventory. Tero.Haatanen@lut.fi ]

Definition at line 687 of file item.c.

References CONTAINER, draw_ext_info(), draw_ext_info_format(), FLAG_IS_FLOOR, FLAG_WIZ, FLESH, get_map_from_coord(), GET_MAP_OB, inventory(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, out_of_map(), QUERY_FLAG, and query_name().

Referenced by look_at_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

void look_at_cmd ( char *  buf,
int  len,
player pl 
)

Client wants to look at some object.

Lets do so.

Definition at line 754 of file item.c.

References pl::blocked_los, FABS, look_at(), MAP_CLIENT_X, MAP_CLIENT_Y, socket_struct::mapx, socket_struct::mapy, pl::ob, and pl::socket.

Here is the call graph for this function:

void mark_item_cmd ( uint8 data,
int  len,
player pl 
)

Client wants to mark some object.

Lets do so.

Parameters:
dataobject tag (4 chars).
lendata size.
plplayer.

Definition at line 655 of file item.c.

References draw_ext_info(), draw_ext_info_format(), esrv_get_ob_from_count(), GetInt_String(), llevDebug, LOG(), pl::mark, pl::mark_count, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, pl::ob, and query_name().

Here is the call graph for this function:

static unsigned int query_flags ( const object *  op) [static]

This is a similar to query_name, but returns flags to be sended to client.

Definition at line 60 of file item.c.

References a_active, a_applied, a_readied, a_wielded, a_worn, AMULET, ARMOUR, BOOTS, BOW, BRACERS, CLOAK, CONTAINER, F_BLESSED, F_CURSED, F_DAMNED, F_LOCKED, F_MAGIC, F_OPEN, F_UNPAID, FLAG_APPLIED, FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_INV_LOCKED, FLAG_KNOWN_BLESSED, FLAG_KNOWN_CURSED, FLAG_KNOWN_MAGICAL, FLAG_UNPAID, flags, GIRDLE, GLOVES, HELMET, HORN, QUERY_FLAG, RING, ROD, SHIELD, SKILL, WAND, and WEAPON.

Referenced by add_object_to_socklist(), and esrv_update_item().

Here is the caller graph for this function: