]> git.pond.sub.org Git - empserver/blob - include/player.h
Document, in particular use of UTF-8. Simplify code in a couple of
[empserver] / include / player.h
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                           Ken Stevens, Steve McClure
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  ---
21  *
22  *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23  *  related information and legal notices. It is expected that any future
24  *  projects/authors will amend these files as needed.
25  *
26  *  ---
27  *
28  *  player.h: Definitions for player information (threads)
29  * 
30  *  Known contributors to this file:
31  *     Dave Pare, 1994
32  *     Doug Hay, 1998
33  */
34
35 #ifndef _PLAYER_H_
36 #define _PLAYER_H_
37
38 #include <sys/types.h>
39 #if !defined(_WIN32)
40 #include <netinet/in.h>
41 #endif
42 #include "queue.h"
43 #include "misc.h"
44 #include "com.h"
45 #include "empthread.h"
46
47 struct player {
48     struct emp_qelem queue;
49     empth_t *proc;
50     s_char hostaddr[32];
51     s_char hostname[512];
52     s_char client[128];
53     s_char userid[32];
54     int validated;
55     natid cnum;
56     int state;
57     int flags;
58     struct cmndstr *command;
59     struct iop *iop;
60     char combuf[1024];          /* command input buffer, UTF-8 */
61     char *argp[128];            /* arguments, ASCII */
62     char *condarg;              /* conditional, ASCII */
63     time_t lasttime;
64     int ncomstat;
65     int minleft;
66     int btused;
67     int visitor;
68     int god;
69     int owner;
70     int nstat;
71     int waiting;
72     int simulation;             /* e.g. budget command */
73     double dolcost;
74     int broke;
75     time_t curup;               /* used in calc of minutes used */
76     int aborted;
77     int curid;                  /* for pr, cur. line's id, -1 none */
78     int blitz_time;
79     char *map;                  /* pointer to in-mem map */
80     char *bmap;                 /* pointer to in-mem bmap */
81 };
82
83 #define PS_INIT         0
84 #define PS_LOGIN        1
85 #define PS_PLAYING      2
86 #define PS_SHUTDOWN     3
87 #define PS_KILL         4
88
89 /* player flags */
90 enum {
91     PF_UTF8 = bit(0)                    /* client wants UTF-8 */
92 };
93
94 /* thread priorities */
95 #define PP_UPDATE       6
96 #define PP_SHUTDOWN     5
97 #define PP_SCHED        4
98 #define PP_TIMESTAMP    2
99 #define PP_PLAYER       3
100 #define PP_ACCEPT       3
101 #define PP_KILLIDLE     2
102
103 #endif /* _PLAYER_H_ */