Crossfire Server, Branch 1.12  R12190
newserver.h
Go to the documentation of this file.
00001 /*
00002  * static char *rcsid_newserver_h =
00003  *   "$Id: newserver.h 11578 2009-02-23 22:02:27Z lalo $";
00004  */
00005 
00006 /*
00007     CrossFire, A Multiplayer game for X-windows
00008 
00009     Copyright (C) 2002 Mark Wedel & Crossfire Development Team
00010     Copyright (C) 1992 Frank Tore Johansen
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025 
00026     The author can be reached via e-mail to crossfire-devel@real-time.com
00027 */
00028 
00037 #ifndef NEWSERVER_H
00038 #define NEWSERVER_H
00039 
00044 #define MIN_NUM_LOOK_OBJECTS 3 /* 3=prev group, one object, next group */
00045 
00050 #define DEFAULT_NUM_LOOK_OBJECTS 50
00051 
00056 #define MAX_NUM_LOOK_OBJECTS 100
00057 
00059 struct map_cell_struct {
00060     uint16 faces[MAP_LAYERS];
00061     uint16 smooth[MAP_LAYERS];
00062     int darkness;
00063 };
00064 
00071 #define MAX_HEAD_OFFSET 8
00072 
00073 #define MAX_CLIENT_X (MAP_CLIENT_X+MAX_HEAD_OFFSET)
00074 #define MAX_CLIENT_Y (MAP_CLIENT_Y+MAX_HEAD_OFFSET)
00075 
00077 struct Map {
00078     struct map_cell_struct cells[MAX_CLIENT_X][MAX_CLIENT_Y];
00079 };
00080 
00082 #define MAXANIMNUM  2000
00083 
00085 struct statsinfo {
00086     char *range, *title;
00087 };
00088 
00089 
00093 enum Sock_Status {
00094     Ns_Avail,
00095     Ns_Add,
00096     Ns_Dead
00097 };
00098 
00103 typedef struct buffer_struct {
00104     char    data[SOCKETBUFSIZE];
00105     int     start;
00106     int     len;
00107 } buffer_struct;
00108 
00110 #define MAX_PASSWORD_FAILURES 5
00111 
00115 typedef struct socket_struct {
00116     enum Sock_Status status;
00117     int         fd;
00118     struct Map  lastmap;
00119     sint8       map_scroll_x, map_scroll_y;
00120     size_t      faces_sent_len;         
00121     uint8       *faces_sent;            
00122     uint8       anims_sent[MAXANIMNUM]; 
00123     struct statsinfo stats;
00124     SockList    inbuf;                  
00125     char        *host;                  
00126     buffer_struct outputbuffer;         
00127     uint8       password_fails;         
00128     uint32      facecache:1;            
00129     uint32      newmapcmd:1;            
00130     uint32      darkness:1;             
00131     uint32      update_look:1;          
00132     uint32      can_write:1;            
00133     uint32      has_readable_type:1;    
00135     uint32      monitor_spells:1;       
00136     uint32      tick:1;                 
00137     uint32      is_bot:1;               
00138     uint32      want_pickup:1;          
00139     uint32      sound;                  
00140     uint32      supported_readables;    
00141     uint32      cs_version, sc_version; 
00142     uint16      look_position;          
00143     uint8       mapx, mapy;             
00144     uint8       faceset;                
00146     /* Below are flags for extedend infos to pass to client
00147      * with S->C mapextended command (note: this comment seems incorrect?) */
00148     sint8       sounds_this_tick;       
00149     uint8       num_look_objects;       
00153 } socket_struct;
00154 
00155 #define CLIENT_SUPPORT_READABLES(__sockPtr, __type)\
00156         (((__type) > 0) && \
00157          ((__sockPtr)->has_readable_type) && \
00158          ((__sockPtr)->supported_readables&(1<<(__type))))
00159 
00164 #define NS_FACESENT_FACE        0x1
00165 #define NS_FACESENT_SMOOTH      0x2
00166 
00167 #define FACE_TYPES  1
00168 #define PNG_FACE_INDEX  0
00169 
00171 typedef struct Socket_Info {
00172     struct timeval timeout;     
00173     int     max_filedescriptor; 
00174     int     nconns;             
00175     int     allocated_sockets;  
00176 } Socket_Info;
00177 
00178 extern Socket_Info socket_info;
00179 
00180 #define VERSION_CS 1023    
00181 #define VERSION_SC 1028
00182 #define VERSION_INFO "Crossfire Server"
00183 
00184 #endif /* NEWSERVER_H */