don't write past the end of the array
[tetrinet.git] / tetrinet.h
blobb1e9c34c7a52e61f4763e4b8b804b38c234a28c1
1 /* Tetrinet for Linux, by Andrew Church <achurch@achurch.org>
2 * This program is public domain.
4 * Tetrinet main include file.
5 */
7 #ifndef TETRINET_H
8 #define TETRINET_H
10 #ifndef IO_H
11 # include "io.h"
12 #endif
14 /*************************************************************************/
16 /* Basic types */
18 #define FIELD_WIDTH 12
19 #define FIELD_HEIGHT 22
20 typedef char Field[FIELD_HEIGHT][FIELD_WIDTH];
22 typedef struct {
23 char name[32];
24 int team; /* 0 = individual player, 1 = team */
25 int points;
26 int games; /* Number of games played */
27 } WinInfo;
28 #define MAXWINLIST 64 /* Maximum size of winlist */
29 #define MAXSENDWINLIST 10 /* Maximum number of winlist entries to send
30 * (this avoids triggering a buffer
31 * overflow in Windows Tetrinet 1.13) */
32 #define MAXSAVEWINLIST 32 /* Maximum number of winlist entries to save
33 * (this allows new players to get into
34 * a winlist with very high scores) */
36 /*************************************************************************/
38 /* Overall display modes */
40 #define MODE_FIELDS 0
41 #define MODE_PARTYLINE 1
42 #define MODE_WINLIST 2
43 #define MODE_SETTINGS 3
44 #define MODE_CLIENT 4 /* Client settings */
45 #define MODE_SERVER 5 /* Server settings */
47 /*************************************************************************/
49 /* Key definitions for input. We use K_* to avoid conflict with ncurses */
51 #define K_UP 0x100
52 #define K_DOWN 0x101
53 #define K_LEFT 0x102
54 #define K_RIGHT 0x103
55 #define K_F1 0x104
56 #define K_F2 0x105
57 #define K_F3 0x106
58 #define K_F4 0x107
59 #define K_F5 0x108
60 #define K_F6 0x109
61 #define K_F7 0x10A
62 #define K_F8 0x10B
63 #define K_F9 0x10C
64 #define K_F10 0x10D
65 #define K_F11 0x10E
66 #define K_F12 0x10F
68 /* For function keys that don't correspond to something above, i.e. that we
69 * don't care about: */
70 #define K_INVALID 0x7FFF
72 /*************************************************************************/
74 /* Externs */
76 extern int fancy;
77 extern int log;
78 extern char *logname;
79 extern int windows_mode;
80 extern int noslide;
81 extern int tetrifast;
82 extern int cast_shadow;
84 extern int my_playernum;
85 extern WinInfo winlist[MAXWINLIST];
86 extern int server_sock;
87 extern int dispmode;
88 extern char *players[6];
89 extern char *teams[6];
90 extern int playing_game;
91 extern int not_playing_game;
92 extern int game_paused;
94 extern Interface *io;
96 /*************************************************************************/
98 #endif