Crossfire Client, Trunk  R20789
player.c File Reference
#include "client.h"
#include "external.h"
#include "script.h"
+ Include dependency graph for player.c:

Go to the source code of this file.

Functions

void clear_fire ()
 
void clear_run ()
 
void client_send_apply (int tag)
 
void client_send_examine (int tag)
 
void client_send_move (int loc, int tag, int nrof)
 
void command_take (const char *command, const char *cpnext)
 
void CompleteCmd (unsigned char *data, int len)
 
void fire_dir (int dir)
 
void look_at (int x, int y)
 
void new_player (long tag, char *name, long weight, long face)
 
void run_dir (int dir)
 
int send_command (const char *command, int repeat, int must_send)
 
void stop_fire ()
 
void stop_run ()
 

Variables

static int dfire =-1
 
const char *const directions []
 
static int drun =-1
 
bool profile_latency = false
 

Detailed Description

Handles various player related functions. This includes both things that operate on the player item, cpl structure, or various commands that the player issues.

Most of the handling of commands from the client to server (see commands.c for server->client) is handled here.

Most of the work for sending messages to the server is done here. Again, most of these appear self explanatory. Most send a bunch of commands like apply, examine, fire, run, etc. This looks like it was done by Mark to remove the old keypress stupidity I used.

Definition in file player.c.

Function Documentation

◆ clear_fire()

void clear_fire ( void  )

Definition at line 100 of file player.c.

References dfire, SC_FIRERUN, and send_command().

Referenced by focusoutfunc(), map_button_event(), and parse_key_release().

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

◆ clear_run()

void clear_run ( void  )

Definition at line 107 of file player.c.

References drun, SC_FIRERUN, and send_command().

Referenced by focusoutfunc(), and parse_key_release().

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

◆ client_send_apply()

void client_send_apply ( int  tag)

Definition at line 71 of file player.c.

References cs_print_string(), csocket, and ClientSocket::fd.

Referenced by list_item_action(), and list_row_collapse().

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

◆ client_send_examine()

void client_send_examine ( int  tag)

Definition at line 75 of file player.c.

References cs_print_string(), csocket, and ClientSocket::fd.

Referenced by list_item_action().

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

◆ client_send_move()

void client_send_move ( int  loc,
int  tag,
int  nrof 
)

Request to move 'nrof' objects with 'tag' to 'loc'.

Definition at line 82 of file player.c.

References cs_print_string(), csocket, and ClientSocket::fd.

Referenced by list_item_action().

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

◆ command_take()

void command_take ( const char *  command,
const char *  cpnext 
)

Definition at line 239 of file player.c.

References Player_Struct::container, Player_Struct::count, cpl, cs_print_string(), csocket, draw_ext_info(), ClientSocket::fd, item_struct::inv, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, NDI_BLACK, Player_Struct::ob, send_command(), and item_struct::tag.

Referenced by do_take().

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

◆ CompleteCmd()

void CompleteCmd ( unsigned char *  data,
int  len 
)

◆ fire_dir()

void fire_dir ( int  dir)

Definition at line 114 of file player.c.

References Player_Struct::count, cpl, dfire, Player_Struct::input_state, MAX_BUF, Playing, SC_NORMAL, and send_command().

Referenced by map_button_event(), and parse_key().

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

◆ look_at()

void look_at ( int  x,
int  y 
)

Definition at line 67 of file player.c.

References cs_print_string(), csocket, and ClientSocket::fd.

Referenced by map_button_event().

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

◆ new_player()

void new_player ( long  tag,
char *  name,
long  weight,
long  face 
)

Initialize player object using information from the server.

Definition at line 43 of file player.c.

References copy_name, cpl, item_struct::d_name, item_struct::face, keybindings_init(), Spell_struct::next, item_struct::nrof, Player_Struct::ob, Player_Struct::spelldata, item_struct::tag, and item_struct::weight.

Referenced by PlayerCmd().

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

◆ run_dir()

void run_dir ( int  dir)

Definition at line 135 of file player.c.

References drun, MAX_BUF, SC_NORMAL, and send_command().

Referenced by map_button_event(), and parse_key().

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

◆ send_command()

◆ stop_fire()

void stop_fire ( void  )

Definition at line 93 of file player.c.

References cpl, dfire, Player_Struct::input_state, and Playing.

Referenced by keyfunc().

+ Here is the caller graph for this function:

◆ stop_run()

void stop_run ( void  )

Definition at line 130 of file player.c.

References drun, SC_FIRERUN, and send_command().

Referenced by keyfunc(), and map_button_event().

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

Variable Documentation

◆ dfire

int dfire =-1
static

Definition at line 91 of file player.c.

Referenced by clear_fire(), fire_dir(), and stop_fire().

◆ directions

const char* const directions[]
Initial value:
= {"stay", "north", "northeast",
"east", "southeast", "south",
"southwest", "west", "northwest"}

Array for direction strings for each numeric direction.

Definition at line 36 of file player.c.

Referenced by keybind_insert().

◆ drun

int drun =-1
static

Definition at line 91 of file player.c.

Referenced by clear_run(), run_dir(), and stop_run().

◆ profile_latency

bool profile_latency = false

Definition at line 33 of file player.c.

Referenced by CompleteCmd(), and send_command().