 |
Crossfire Client, Trunk
|
Go to the documentation of this file.
41 const char *
const directions[] = {
"stay",
"north",
"northeast",
42 "east",
"southeast",
"south",
43 "southwest",
"west",
"northwest"};
54 void new_player(
long tag,
char *name,
long weight,
long face) {
55 Spell *spell, *spnext;
62 if (strlen(name) != 0) {
131 snprintf(buf,
sizeof(buf),
"fire %d", dir);
149 snprintf(buf,
sizeof(buf),
"run %d", dir);
161 for (
int i = 0; i < 9; i++) {
219 return strncmp(prefix, str, strlen(prefix)) == 0;
232 static char last_command[
MAX_BUF]=
"";
235 LOG(
LOG_ERROR,
"common::send_command",
"Wont send command '%s' - since in reply mode!",
267 fprintf(stderr,
"Wont send command %s - window oversized %d %d\n",
278 strcpy(last_command, command);
299 if (
drun == -1 && dir != -1) {
319 LOG(
LOG_ERROR,
"common::CompleteCmd",
"Invalid length %d - ignoring", len);
326 gint64 now = g_get_monotonic_time();
328 printf(
"profile/comc\t%d\t%" G_GINT64_FORMAT
"\t%d\t%d\n",
335 if (
drun == -1 && dir != -1) {
359 "There is nothing in the container to move");
#define MSG_TYPE_CLIENT
Client originated Messages.
short GetShort_String(const unsigned char *data)
void client_send_move(int loc, int tag, int nrof)
Request to move 'nrof' objects with 'tag' to 'loc'.
void SockList_Init(SockList *sl, guint8 *buf)
guint16 command_received
These are used for the newer 'windowing' method of commands - number of last command sent,...
void keybindings_init(const char *character_name)
Reads in the keybindings, and initializes special values.
void script_sync(int commdiff)
Input_State input_state
What the input state is.
#define COMMAND_MAX
Largest ncom command number to send before wrapping.
int SockList_Send(SockList *sl, GSocketConnection *c)
Send data from a socklist to the socket.
void SockList_AddShort(SockList *sl, guint16 data)
bool is_afk
Best guess whether or not we are currently AFK or not.
int command_time
Time (in ms) players commands currently take to execute.
void new_player(long tag, char *name, long weight, long face)
Initialize player object using information from the server.
int GetInt_String(const unsigned char *data)
The reverse of SockList_AddInt, but on strings instead.
void SockList_AddInt(SockList *sl, guint32 data)
struct Spell_struct * next
item * container
open container
const char *const directions[]
256-length array to keep track of when commands were sent to the server
void command_take(const char *command, const char *cpnext)
void SockList_AddString(SockList *sl, const char *str)
void script_monitor(const char *command, int repeat, int must_send)
void LOG(LogLevel level, const char *origin, const char *format,...)
Log messages of a certain importance to stderr.
int cs_print_string(GSocketConnection *fd, const char *str,...)
Send a printf-formatted packet to the socket.
void draw_ext_info(int orig_color, int type, int subtype, const char *message)
A message processor that accepts messages along with meta information color and type.
static bool starts_with(const char *prefix, const char *str)
int command_to_direction(const char *dir)
int send_command(const char *command, int repeat, int must_send)
@ LOG_ERROR
Warning that something definitely didn't work.
void predict_scroll(int dir)
Change map drawing offset to provide local movement prediction based on player's movement commands to...
void client_send_apply(int tag)
const char * dir_to_command(int dir)
Client_Player cpl
Player object.
#define MSG_TYPE_CLIENT_NOTICE
Non-critical note to player.
guint32 count
Repeat count on command.
gint16 use_config[CONFIG_NUMS]
void look_at(int x, int y)
Spell * spelldata
List of spells known.
Contains the base information we use to make up a packet we want to send.
time_t last_command_sent
Time when last command was sent.
void client_send_examine(int tag)
void CompleteCmd(unsigned char *data, int len)