/*
 * static char *rcsid_newserver_h =
 *   "$Id: newserver.h,v 1.3 1998/05/16 02:26:41 master Exp master $";
 */

/*
    CrossFire, A Multiplayer game for X-windows

    Copyright (C) 1994 Mark Wedel
    Copyright (C) 1992 Frank Tore Johansen

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    The author can be reached via e-mail to mark@pyramid.com

    newserver.h defines various structures and values that are use for the
    new client server communication method.  Values defined here are only
    used on the server side code.  For shared client/server values, see
    newclient.h
*/


#ifndef NEWSERVER_H
#define NEWSERVER_H
#define MAXMAPCELLFACES 50

/* To pull in some typdefs */
#include <structs.h>

struct MapCell {
  short faces[MAXMAPCELLFACES];
  int count;
};

struct Map {
  struct MapCell cells[11][11];
};

/* True max is 16383 given current map compaction method */
#define MAXFACENUM  5000
#define MAXANIMNUM  2000

struct statsinfo {
    char *range, *title;
};


/* This contains basic information on the socket structure.  status is its
 * current state.  we set up our on buffers for sending/receiving, so we can
 * handle some higher level functions.  fd is the actual file descriptor we
 * are using.
 */
enum FaceSendMode { Send_Face_Pixmap, Send_Face_Bitmap, Send_Face_None};

enum Sock_Status {Ns_Init, Ns_Add, Ns_Dead};
typedef struct NewSocket {
    enum Sock_Status status;
    int fd;
    enum FaceSendMode facemode;
    uint32  facecache:1;    /* IF true, client is caching images */
    uint32  client_id;
    struct Map lastmap;
    uint8 faces_sent[MAXFACENUM];
    uint8 anims_sent[MAXANIMNUM];
    struct statsinfo stats;
    /* If we get an incomplete packet, this is used to hold the data. */
    SockList	inbuf;
    char    *host;	    /* Which host it is connected from */
    uint32  sent_scroll:1;
    uint32  sound:1;	    /* does the client want sound? */
} NewSocket;
extern NewSocket *cs_sockets;

#endif
