… | |
… | |
89 | struct statsinfo |
89 | struct statsinfo |
90 | { |
90 | { |
91 | char *range, *title; |
91 | char *range, *title; |
92 | }; |
92 | }; |
93 | |
93 | |
94 | /* This contains basic information on the socket structure. status is its |
|
|
95 | * current state. we set up our on buffers for sending/receiving, so we can |
|
|
96 | * handle some higher level functions. fd is the actual file descriptor we |
|
|
97 | * are using. |
|
|
98 | */ |
|
|
99 | |
|
|
100 | // states the socket can be in |
94 | // states the socket can be in |
101 | enum { |
95 | enum { |
102 | ST_DEAD, // socket is dead |
96 | ST_DEAD, // socket is dead |
103 | ST_SETUP, // initial handshake / setup / login |
97 | ST_SETUP, // initial handshake / setup / login |
104 | ST_PLAYING, // logged in an playing |
98 | ST_PLAYING, // logged in an playing |
… | |
… | |
113 | PF_PLAYING = 0x02, // must be in playing state |
107 | PF_PLAYING = 0x02, // must be in playing state |
114 | PF_COMMAND0 = 0x04, // command starts at offset 0 |
108 | PF_COMMAND0 = 0x04, // command starts at offset 0 |
115 | PF_COMMAND6 = 0x08, // command starts at offset 6 |
109 | PF_COMMAND6 = 0x08, // command starts at offset 6 |
116 | }; |
110 | }; |
117 | |
111 | |
118 | // face type.s bit 0 means "has meta info prepended" |
112 | // face types. bit 0 means "has meta info prepended" |
119 | enum { |
113 | enum { |
120 | FT_FACE = 0 * 2 + 0, // faces (images) |
114 | FT_FACE = 0 * 2 + 0, // faces (images) |
121 | FT_MUSIC = 1 * 2 + 1, // background music |
115 | FT_MUSIC = 1 * 2 + 1, // background music |
122 | FT_SOUND = 2 * 2 + 1, // effects |
116 | FT_SOUND = 2 * 2 + 1, // effects |
123 | FT_RSRC = 3 * 2 + 0, // generic data files |
117 | FT_RSRC = 3 * 2 + 0, // generic data files |
… | |
… | |
142 | //-GPL |
136 | //-GPL |
143 | |
137 | |
144 | /* how many times we are allowed to give the wrong password before being kicked. */ |
138 | /* how many times we are allowed to give the wrong password before being kicked. */ |
145 | #define MAX_PASSWORD_FAILURES 5 |
139 | #define MAX_PASSWORD_FAILURES 5 |
146 | |
140 | |
|
|
141 | /* This contains basic information on the socket connection. status is its |
|
|
142 | * current state. we set up our on buffers for sending/receiving, so we can |
|
|
143 | * handle some higher level functions. fd is the actual file descriptor we |
|
|
144 | * are using. |
|
|
145 | */ |
147 | INTERFACE_CLASS (client) // should become player when newsocket is a baseclass of player |
146 | INTERFACE_CLASS (client) // should become player when newsocket is a baseclass of player |
148 | struct client : zero_initialised, attachable |
147 | struct client : zero_initialised, attachable |
149 | { |
148 | { |
150 | int ACC (RW, fd); |
149 | int ACC (RW, fd); |
151 | unsigned int inbuf_len; // number of bytes valid in inbuf |
150 | unsigned int inbuf_len; // number of bytes valid in inbuf |
… | |
… | |
221 | |
220 | |
222 | struct ixsend { |
221 | struct ixsend { |
223 | int16_t pri; // higher means faces are sent earlier, default 0 |
222 | int16_t pri; // higher means faces are sent earlier, default 0 |
224 | faceidx idx; |
223 | faceidx idx; |
225 | uint32_t ofs; // if != 0, need to send remaining bytes of partial_face |
224 | uint32_t ofs; // if != 0, need to send remaining bytes of partial_face |
|
|
225 | refcnt_buf data; |
226 | }; |
226 | }; |
227 | std::vector<ixsend, slice_allocator<ixsend> > ixface; // which faces to send to the client using ix |
227 | std::vector<ixsend, slice_allocator<ixsend> > ixface; // which faces to send to the client using ix |
228 | |
228 | |
229 | std::vector<faceidx, slice_allocator<faceidx> > fxface; // which faces to send using fx |
229 | std::vector<faceidx, slice_allocator<faceidx> > fxface; // which faces to send using fx |
230 | MTH void flush_fx (); // send fx if required |
230 | MTH void flush_fx (); // send fx if required |