Crossfire Server  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 {
94  enum Sock_Status status;
95  int fd;
97  struct Map lastmap;
98  int8_t map_scroll_x, map_scroll_y;
99  size_t faces_sent_len;
100  uint8_t *faces_sent;
101  uint8_t anims_sent[MAXANIMNUM];
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 */
uint8_t login_method
Login method this client is using.
Definition: newserver.h:132
uint8_t faceset
Set the client is using, default 0.
Definition: newserver.h:121
uint32_t tick
Client wishes to get tick commands.
Definition: newserver.h:110
uint32_t want_pickup
Client wants pickup information when logging in.
Definition: newserver.h:112
char * account_name
Name of the account logged in on this socket.
Definition: newserver.h:130
Sock_Status
What state a socket is in.
Definition: newserver.h:68
int protocol
Definition: newserver.h:82
uint16_t look_position
Start of drawing of look window.
Definition: newserver.h:118
enum map2_label label_subtype
Definition: newserver.h:34
uint32_t last_tick
Number of ticks since last communication.
Definition: newserver.h:134
Socket structure, represents a client-server connection.
Definition: newserver.h:93
struct sockaddr * addr
Definition: newserver.h:84
bool heartbeat
Client will send hearbeats.
Definition: newserver.h:116
int8_t sounds_this_tick
Number of sounds sent this tick.
Definition: newserver.h:125
uint16_t container_position
Start of container contents to send to client.
Definition: newserver.h:119
#define socklen_t
Definition: win32.h:17
sstring label_text
Definition: newserver.h:35
int max_filedescriptor
max filedescriptor on the system.
Definition: newserver.h:147
char * title
Definition: newserver.h:61
One map cell, as sent to the client.
Definition: newserver.h:31
int socktype
Definition: newserver.h:81
char * host
Which host it is connected from (ip address).
Definition: newserver.h:104
socklen_t addrlen
Definition: newserver.h:83
Account_Chars * account_chars
Detailed information on characters on this account.
Definition: newserver.h:131
uint16_t notifications
Notifications this client wants to get.
Definition: newserver.h:133
size_t faces_sent_len
This is the number of elements allocated in faces_sent[].
Definition: newserver.h:99
uint32_t update_look
If true, we need to send the look window.
Definition: newserver.h:108
uint32_t facecache
If true, client is caching images.
Definition: newserver.h:106
uint32_t sound
Client sound mode.
Definition: newserver.h:115
Socket_Info socket_info
Socket information.
Definition: init.cpp:52
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
Holds some system-related information.
Definition: newserver.h:145
map2_label
Map label subtypes.
Definition: newclient.h:56
Contains the last range/title information sent to client.
Definition: newserver.h:60
#define MAX_CLIENT_Y
Definition: newserver.h:49
One map for a player.
Definition: newserver.h:52
#define MAXANIMNUM
True max is 16383 given current map compaction method.
Definition: newserver.h:57
#define MAP_LAYERS
This correspondes to the map layers in the map2 protocol.
Definition: map.h:32
int8_t map_scroll_y
Definition: newserver.h:98
uint32_t sc_version
Versions of the client.
Definition: newserver.h:117
Contains parameters for socket() and bind() for listening sockets.
Definition: newserver.h:79
uint32_t update_inventory
If true, we need to send the inventory list.
Definition: newserver.h:109
int allocated_sockets
Number of allocated items in init_sockets.
Definition: newserver.h:148
uint32_t is_bot
Client shouldn&#39;t be reported to metaserver.
Definition: newserver.h:111
uint32_t extended_stats
Client wants base and maximum statistics information.
Definition: newserver.h:113
Structure handling character information for an account.
Definition: account_char.h:27
#define MAX_CLIENT_X
Definition: newserver.h:48
uint32_t darkness
True if client wants darkness information.
Definition: newserver.h:107
uint8_t password_fails
How many times the player has failed to give the right password.
Definition: newserver.h:105
int darkness
Cell&#39;s darkness.
Definition: newserver.h:33
uint32_t monitor_spells
Client wishes to be informed when their spell list changes.
Definition: newserver.h:114
int family
Definition: newserver.h:80
Contains the base information we use to make up a packet we want to send.
Definition: newclient.h:721
const char * sstring
Definition: sstring.h:2
uint8_t mapy
How large a map the client wants.
Definition: newserver.h:120
struct listen_info * listen
Definition: newserver.h:96
uint8_t * faces_sent
This is a bitmap on sent face status.
Definition: newserver.h:100
uint16_t faces[MAP_LAYERS]
Face numbers.
Definition: newserver.h:32
SockList inbuf
If we get an incomplete packet, this is used to hold the data.
Definition: newserver.h:103