Atrinik Server  4.0
newserver.h
Go to the documentation of this file.
1 /*************************************************************************
2  * Atrinik, a Multiplayer Online Role Playing Game *
3  * *
4  * Copyright (C) 2009-2014 Alex Tokar and Atrinik Development Team *
5  * *
6  * Fork from Crossfire (Multiplayer game for X-windows). *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
21  * *
22  * The author can be reached at admin@atrinik.org *
23  ************************************************************************/
24 
31 #ifndef NEWSERVER_H
32 #define NEWSERVER_H
33 
34 #include "map.h"
35 
37 #define NUM_LOOK_OBJECTS 15
38 
43 typedef struct MapCell_struct {
46 
47  /* Everything below will be cleared by memset() in when the map
48  * cell is no longer visible. */
49 
50  uint8_t cleared;
51 
54 
57 
60 
63 
64  uint8_t anim_speed[NUM_REAL_LAYERS];
65 
66  uint8_t anim_facing[NUM_REAL_LAYERS];
67 
68  uint8_t anim_flags[NUM_SUB_LAYERS];
69 
74  uint8_t probe;
75 
80 
81  uint8_t ext_flags;
82 
83  uint8_t client_flags[NUM_SUB_LAYERS];
84 
85  uint8_t anim_num;
86 
88 } MapCell;
89 
91 struct Map {
93  struct MapCell_struct cells[MAP_CLIENT_X][MAP_CLIENT_Y];
94 };
95 
97 enum {
98  ST_AVAILABLE,
99  ST_WAITING,
100  ST_LOGIN,
101  ST_PLAYING,
102  ST_DEAD,
103  ST_ZOMBIE
104 };
105 
107 typedef struct socket_struct {
109  socket_t *sc;
110 
116 
118  int mapx;
119 
121  int mapy;
122 
124  int mapx_2;
125 
127  int mapy_2;
128 
130  uint32_t socket_version;
131 
134  uint32_t update_tile;
135 
137  uint32_t below_clear : 1;
138 
140  uint32_t addme : 1;
141 
143  uint32_t sound : 1;
144 
146  uint8_t is_bot;
147 
149  uint32_t look_position;
150 
152  uint8_t faceset;
153 
158  uint8_t password_fails;
159 
161  uint8_t ext_title_flag;
162 
164  int state;
165 
167  struct Map lastmap;
168 
170  struct packet_struct *packets;
171 
177  uint32_t keepalive;
178 
179  char *account;
180 
181  struct packet_struct *packet_recv;
182  struct packet_struct *packet_recv_cmd;
183 } socket_struct;
184 
189 #define SOCKET_KEEPALIVE_TIMEOUT (uint32_t) ((60 * 10) * MAX_TICKS_MULTIPLIER)
190 
192 typedef struct Socket_Info_struct {
194  struct timeval timeout;
195 
198 
200  int nconns;
201 
204 } Socket_Info;
205 
210 typedef struct update_file_struct {
212  unsigned long checksum;
213 
215  size_t len;
216 
218  size_t ucomp_len;
219 
221  char *filename;
222 
224  uint8_t *contents;
225 
227  struct packet_struct *packet;
229 
231 #define UPDATES_FILE_NAME "updates"
232 
236 #define UPDATES_DIR_NAME "updates"
237 
242 #define MAX_PASSWORD_FAILURES 3
243 
244 #endif
socket_t * sc
Definition: newserver.h:109
tag_t target_object_count
Definition: newserver.h:79
uint8_t faceset
Definition: newserver.h:152
uint32_t update_tile
Definition: newserver.h:134
uint8_t is_friend
Friendly state cache.
Definition: newserver.h:87
struct socket_struct socket_struct
struct update_file_struct update_file_struct
struct Map lastmap
Definition: newserver.h:167
struct packet_struct * packets
Definition: newserver.h:170
uint8_t flags[NUM_REAL_LAYERS]
Definition: newserver.h:62
uint32_t socket_version
Definition: newserver.h:130
uint8_t * contents
Definition: newserver.h:224
struct timeval timeout
Definition: newserver.h:194
uint32_t sound
Definition: newserver.h:143
uint32_t keepalive
Definition: newserver.h:177
struct MapCell_struct MapCell
uint16_t darkness[NUM_SUB_LAYERS]
Definition: newserver.h:53
uint8_t is_bot
Definition: newserver.h:146
uint8_t anim_num
Last number of animations sent.
Definition: newserver.h:85
Definition: newserver.h:91
uint8_t ext_title_flag
Definition: newserver.h:161
uint32_t addme
Definition: newserver.h:140
uint32_t below_clear
Definition: newserver.h:137
uint8_t quick_pos[NUM_REAL_LAYERS]
Definition: newserver.h:59
struct packet_struct * packet
Definition: newserver.h:227
#define NUM_SUB_LAYERS
Definition: map.h:71
#define MAP_CLIENT_X
Definition: config.h:62
uint8_t password_fails
Definition: newserver.h:158
#define NUM_REAL_LAYERS
Definition: map.h:75
struct MapCell_struct cells[MAP_CLIENT_X][MAP_CLIENT_Y]
Definition: newserver.h:93
uint8_t ext_flags
Last ext flags.
Definition: newserver.h:81
uint32_t look_position
Definition: newserver.h:149
uint8_t probe
Definition: newserver.h:74
int16_t faces[NUM_REAL_LAYERS]
Definition: newserver.h:56
unsigned long checksum
Definition: newserver.h:212
struct Socket_Info_struct Socket_Info
tag_t sound_ambient_count
Definition: newserver.h:45