Atrinik Server 2.5
include/newserver.h
Go to the documentation of this file.
00001 /************************************************************************
00002 *            Atrinik, a Multiplayer Online Role Playing Game            *
00003 *                                                                       *
00004 *    Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team    *
00005 *                                                                       *
00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game)     *
00007 * and Crossfire (Multiplayer game for X-windows).                       *
00008 *                                                                       *
00009 * This program is free software; you can redistribute it and/or modify  *
00010 * it under the terms of the GNU General Public License as published by  *
00011 * the Free Software Foundation; either version 2 of the License, or     *
00012 * (at your option) any later version.                                   *
00013 *                                                                       *
00014 * This program is distributed in the hope that it will be useful,       *
00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00017 * GNU General Public License for more details.                          *
00018 *                                                                       *
00019 * You should have received a copy of the GNU General Public License     *
00020 * along with this program; if not, write to the Free Software           *
00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             *
00022 *                                                                       *
00023 * The author can be reached at admin@atrinik.org                        *
00024 ************************************************************************/
00025 
00033 #ifndef NEWSERVER_H
00034 #define NEWSERVER_H
00035 
00037 #define NUM_LOOK_OBJECTS 15
00038 
00045 #define MAP2_FLAG_MULTI      1
00046 
00047 #define MAP2_FLAG_NAME       2
00048 
00049 #define MAP2_FLAG_PROBE      4
00050 
00051 #define MAP2_FLAG_HEIGHT     8
00052 
00053 #define MAP2_FLAG_ZOOM 16
00054 
00055 #define MAP2_FLAG_ALIGN 32
00056 
00057 #define MAP2_FLAG_DOUBLE 64
00058 
00059 #define MAP2_FLAG_MORE 128
00060 
00068 #define MAP2_FLAG2_ALPHA 1
00069 
00070 #define MAP2_FLAG2_ROTATE 2
00071 
00072 #define MAP2_FLAG2_INFRAVISION 4
00073 
00081 #define MAP2_FLAG_EXT_ANIM   1
00082 
00089 #define ANIM_DAMAGE     1
00090 
00091 #define ANIM_KILL       2
00092 
00099 #define MAP2_MASK_CLEAR      0x2
00100 
00101 #define MAP2_MASK_DARKNESS   0x4
00102 
00108 #define MAP2_LAYER_CLEAR    255
00109 
00116 #define CMD_MAPSTATS_NAME 1
00117 
00118 #define CMD_MAPSTATS_MUSIC 2
00119 
00120 #define CMD_MAPSTATS_WEATHER 3
00121 
00126 typedef struct MapCell_struct
00127 {
00129     int count;
00130 
00132     sint16 faces[NUM_LAYERS];
00133 
00135     uint8 quick_pos[NUM_LAYERS];
00136 
00138     uint8 flags[NUM_LAYERS];
00139 
00143     uint8 probe;
00144 } MapCell;
00145 
00147 struct Map
00148 {
00150     struct MapCell_struct cells[MAP_CLIENT_X][MAP_CLIENT_Y];
00151 };
00152 
00154 enum Sock_Status
00155 {
00156     Ns_Avail,
00157     Ns_Wait,
00158     Ns_Add,
00159     Ns_Login,
00160     Ns_Dead,
00161     Ns_Zombie
00162 };
00163 
00167 typedef struct socket_buffer
00168 {
00170     struct socket_buffer *next;
00171 
00173     struct socket_buffer *last;
00174 
00176     char *buf;
00177 
00179     size_t len;
00180 
00182     size_t pos;
00183 
00185     uint8 ndelay;
00186 } socket_buffer;
00187 
00189 typedef struct socket_struct
00190 {
00192     int fd;
00193 
00197     int login_count;
00198 
00200     int mapx;
00201 
00203     int mapy;
00204 
00206     int mapx_2;
00207 
00209     int mapy_2;
00210 
00212     char *host;
00213 
00215     uint32 socket_version;
00216 
00218     uint32 update_tile;
00219 
00221     uint32 below_clear:1;
00222 
00224     uint32 addme:1;
00225 
00227     uint32 sound:1;
00228 
00230     uint32 version:1;
00231 
00233     uint32 rf_settings:1;
00234 
00236     uint32 rf_skills:1;
00237 
00239     uint32 rf_spells:1;
00240 
00242     uint32 rf_anims:1;
00243 
00245     uint32 rf_bmaps:1;
00246 
00248     uint32 rf_hfiles:1;
00249 
00251     uint32 is_bot:1;
00252 
00254     sint16 look_position;
00255 
00257     uint8 faceset;
00258 
00262     uint8 password_fails;
00263 
00265     uint8 ext_title_flag;
00266 
00268     enum Sock_Status status;
00269 
00271     struct Map lastmap;
00272 
00274     SockList inbuf;
00275 
00277     SockList readbuf;
00278 
00280     SockList cmdbuf;
00281 
00283     socket_buffer *buffer_front;
00284 
00286     socket_buffer *buffer_back;
00287 
00292     uint32 keepalive;
00293 } socket_struct;
00294 
00298 #define SOCKET_KEEPALIVE_TIMEOUT (60 * 5)
00299 
00301 typedef struct Socket_Info_struct
00302 {
00304     struct timeval timeout;
00305 
00307     int max_filedescriptor;
00308 
00310     int nconns;
00311 
00313     int allocated_sockets;
00314 } Socket_Info;
00315 
00316 extern Socket_Info socket_info;
00317 
00321 typedef struct update_file_struct
00322 {
00324     unsigned long checksum;
00325 
00327     size_t len;
00328 
00330     size_t ucomp_len;
00331 
00333     char *filename;
00334 
00336     char *contents;
00337 
00339     SockList sl;
00340 } update_file_struct;
00341 
00343 #define UPDATES_FILE_NAME "updates"
00344 
00347 #define UPDATES_DIR_NAME "updates"
00348 
00352 #define MAX_PASSWORD_FAILURES 3
00353 
00354 #endif