Crossfire Server, Trunk  1.75.0
newserver.h
Go to the documentation of this file.
1 
9 #ifndef NEWSERVER_H
10 #define NEWSERVER_H
11 
16 #define MIN_NUM_LOOK_OBJECTS 3 /* 3=prev group, one object, next group */
17 
22 #define DEFAULT_NUM_LOOK_OBJECTS 50
23 
28 #define MAX_NUM_LOOK_OBJECTS 100
29 
32  uint16_t faces[MAP_LAYERS];
33  int darkness;
34  enum map2_label label_subtype; //< Type of last label, or 0 if no label
35  sstring label_text; //< Text of last label as a shared string, invalid pointer if subtype = 0
36  // TODO: One cell can contain multiple labels, but this only stores the first one. So if there
37  // are multiple labels, the server resorts to sending all labels each tick.
38 };
39 
46 #define MAX_HEAD_OFFSET 8
47 
48 #define MAX_CLIENT_X (MAP_CLIENT_X+MAX_HEAD_OFFSET)
49 #define MAX_CLIENT_Y (MAP_CLIENT_Y+MAX_HEAD_OFFSET)
50 
52 struct Map {
54 };
55 
57 #define MAXANIMNUM 2000
58 
60 struct statsinfo {
61  char *range, *title, *god;
62 };
63 
64 
72 };
73 
79 struct listen_info {
80  int family;
81  int socktype;
82  int protocol;
84  struct sockaddr *addr;
85 };
86 
88 #define MAX_PASSWORD_FAILURES 5
89 
93 struct socket_struct {
95  int fd;
97  struct Map lastmap;
99  size_t faces_sent_len;
100  uint8_t *faces_sent;
102  struct statsinfo stats;
104  char *host;
105  uint8_t password_fails;
106  uint32_t facecache:1;
107  uint32_t darkness:1;
108  uint32_t update_look:1;
109  uint32_t update_inventory:1;
110  uint32_t tick:1;
111  uint32_t is_bot:1;
112  uint32_t want_pickup:1;
113  uint32_t extended_stats:1;
114  uint32_t monitor_spells;
115  uint32_t sound;
116  bool heartbeat;
117  uint32_t cs_version, sc_version;
118  uint16_t look_position;
120  uint8_t mapx, mapy;
121  uint8_t faceset;
123  /* Below are flags for extedend infos to pass to client
124  * with S->C mapextended command (note: this comment seems incorrect?) */
130  char *account_name;
132  uint8_t login_method;
133  uint16_t notifications;
134  uint32_t last_tick;
135 };
136 
141 #define NS_FACESENT_FACE 0x1
142 #define NS_FACESENT_SMOOTH 0x2
143 
145 struct Socket_Info {
146  struct timeval timeout;
149 };
150 
151 extern Socket_Info socket_info;
152 
153 #define VERSION_CS 1023
154 #define VERSION_SC 1030
155 #define VERSION_INFO "Crossfire Server"
156 
157 #endif /* NEWSERVER_H */
socket_struct::tick
uint32_t tick
Client wishes to get tick commands.
Definition: newserver.h:110
socket_struct::sc_version
uint32_t sc_version
Versions of the client.
Definition: newserver.h:117
socket_struct::heartbeat
bool heartbeat
Client will send hearbeats.
Definition: newserver.h:116
Map
One map for a player.
Definition: newserver.h:52
socket_struct::container_position
uint16_t container_position
Start of container contents to send to client.
Definition: newserver.h:119
socket_struct::look_position
uint16_t look_position
Start of drawing of look window.
Definition: newserver.h:118
listen_info::protocol
int protocol
Definition: newserver.h:82
listen_info
Contains parameters for socket() and bind() for listening sockets.
Definition: newserver.h:79
socket_struct::sound
uint32_t sound
Client sound mode.
Definition: newserver.h:115
socket_struct
Socket structure, represents a client-server connection.
Definition: newserver.h:93
socket_struct::mapx
uint8_t mapx
Definition: newserver.h:120
Socket_Info::allocated_sockets
int allocated_sockets
Number of allocated items in init_sockets.
Definition: newserver.h:148
socket_struct::num_look_objects
uint8_t num_look_objects
The maximum number of objects to show on the ground view; this number includes the prev/next group fa...
Definition: newserver.h:126
map_cell_struct::label_text
sstring label_text
Definition: newserver.h:35
socket_info
Socket_Info socket_info
Socket information.
Definition: init.cpp:52
socket_struct::extended_stats
uint32_t extended_stats
Client wants base and maximum statistics information.
Definition: newserver.h:113
socket_struct::update_inventory
uint32_t update_inventory
If true, we need to send the inventory list.
Definition: newserver.h:109
listen_info::addr
struct sockaddr * addr
Definition: newserver.h:84
Socket_Info::max_filedescriptor
int max_filedescriptor
max filedescriptor on the system.
Definition: newserver.h:147
MAP_LAYERS
#define MAP_LAYERS
Definition: map.h:32
socket_struct::is_bot
uint32_t is_bot
Client shouldn't be reported to metaserver.
Definition: newserver.h:111
socket_struct::listen
struct listen_info * listen
Definition: newserver.h:96
listen_info::socktype
int socktype
Definition: newserver.h:81
MAXANIMNUM
#define MAXANIMNUM
True max is 16383 given current map compaction method.
Definition: newserver.h:57
socket_struct::inbuf
SockList inbuf
If we get an incomplete packet, this is used to hold the data.
Definition: newserver.h:103
socket_struct::map_scroll_x
int8_t map_scroll_x
Definition: newserver.h:98
map2_label
map2_label
Map label subtypes.
Definition: newclient.h:56
Socket_Info
Holds some system-related information.
Definition: newserver.h:145
socket_struct::update_look
uint32_t update_look
If true, we need to send the look window.
Definition: newserver.h:108
Ns_Dead
@ Ns_Dead
Definition: newserver.h:71
socket_struct::account_chars
Account_Chars * account_chars
Detailed information on characters on this account.
Definition: newserver.h:131
socket_struct::mapy
uint8_t mapy
How large a map the client wants.
Definition: newserver.h:120
socket_struct::stats
struct statsinfo stats
Definition: newserver.h:102
Ns_Avail
@ Ns_Avail
Definition: newserver.h:69
map_cell_struct
One map cell, as sent to the client.
Definition: newserver.h:31
socklen_t
#define socklen_t
Definition: win32.h:17
socket_struct::facecache
uint32_t facecache
If true, client is caching images.
Definition: newserver.h:106
map_cell_struct::darkness
int darkness
Cell's darkness.
Definition: newserver.h:33
MAX_CLIENT_X
#define MAX_CLIENT_X
Definition: newserver.h:48
statsinfo
Contains the last range/title information sent to client.
Definition: newserver.h:60
socket_struct::lastmap
struct Map lastmap
Definition: newserver.h:97
socket_struct::host
char * host
Which host it is connected from (ip address).
Definition: newserver.h:104
socket_struct::account_name
char * account_name
Name of the account logged in on this socket.
Definition: newserver.h:130
socket_struct::monitor_spells
uint32_t monitor_spells
Client wishes to be informed when their spell list changes.
Definition: newserver.h:114
map_cell_struct::faces
uint16_t faces[MAP_LAYERS]
Face numbers.
Definition: newserver.h:32
socket_struct::faceset
uint8_t faceset
Set the client is using, default 0.
Definition: newserver.h:121
socket_struct::map_scroll_y
int8_t map_scroll_y
Definition: newserver.h:98
statsinfo::title
char * title
Definition: newserver.h:61
socket_struct::cs_version
uint32_t cs_version
Definition: newserver.h:117
Ns_Add
@ Ns_Add
Definition: newserver.h:70
listen_info::family
int family
Definition: newserver.h:80
socket_struct::sounds_this_tick
int8_t sounds_this_tick
Number of sounds sent this tick.
Definition: newserver.h:125
socket_struct::want_pickup
uint32_t want_pickup
Client wants pickup information when logging in.
Definition: newserver.h:112
socket_struct::last_tick
uint32_t last_tick
Number of ticks since last communication.
Definition: newserver.h:134
Socket_Info::timeout
struct timeval timeout
Timeout for select.
Definition: newserver.h:146
sstring
const typedef char * sstring
Definition: sstring.h:2
socket_struct::status
enum Sock_Status status
Definition: newserver.h:94
statsinfo::god
char * god
Definition: newserver.h:61
Map::cells
struct map_cell_struct cells[MAX_CLIENT_X][MAX_CLIENT_Y]
Definition: newserver.h:53
socket_struct::faces_sent_len
size_t faces_sent_len
This is the number of elements allocated in faces_sent[].
Definition: newserver.h:99
socket_struct::anims_sent
uint8_t anims_sent[MAXANIMNUM]
What animations we sent.
Definition: newserver.h:101
socket_struct::faces_sent
uint8_t * faces_sent
This is a bitmap on sent face status.
Definition: newserver.h:100
Account_Chars
Structure handling character information for an account.
Definition: account_char.h:27
map_cell_struct::label_subtype
enum map2_label label_subtype
Definition: newserver.h:34
socket_struct::fd
int fd
Definition: newserver.h:95
MAX_CLIENT_Y
#define MAX_CLIENT_Y
Definition: newserver.h:49
socket_struct::login_method
uint8_t login_method
Login method this client is using.
Definition: newserver.h:132
statsinfo::range
char * range
Definition: newserver.h:61
listen_info::addrlen
socklen_t addrlen
Definition: newserver.h:83
Sock_Status
Sock_Status
What state a socket is in.
Definition: newserver.h:68
socket_struct::darkness
uint32_t darkness
True if client wants darkness information.
Definition: newserver.h:107
socket_struct::notifications
uint16_t notifications
Notifications this client wants to get.
Definition: newserver.h:133
socket_struct::password_fails
uint8_t password_fails
How many times the player has failed to give the right password.
Definition: newserver.h:105
SockList
Contains the base information we use to make up a packet we want to send.
Definition: newclient.h:685