Crossfire Client, Trunk  R20507
Functions | Variables
player.c File Reference

Handles various player related functions. More...

#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)
 Request to move 'nrof' objects with 'tag' to 'loc'. More...
 
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)
 Initialize player object using information from the server. More...
 
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 []
 Array for direction strings for each numeric direction. More...
 
static int drun =-1
 

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 98 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 105 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 69 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 73 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 80 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 227 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 
)

Definition at line 212 of file player.c.

References ClientSocket::command_received, ClientSocket::command_sent, ClientSocket::command_time, csocket, GetInt_String(), GetShort_String(), LOG(), LOG_ERROR, and script_sync().

Here is the call graph for this function:

◆ fire_dir()

void fire_dir ( int  dir)

Definition at line 112 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 65 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 41 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 133 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()

int send_command ( const char *  command,
int  repeat,
int  must_send 
)

◆ stop_fire()

void stop_fire ( void  )

Definition at line 91 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 128 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 89 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 34 of file player.c.

Referenced by keybind_insert().

◆ drun

int drun =-1
static

Definition at line 89 of file player.c.

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