160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
disconnect();
return;
}
conoutf(@"attempting to disconnect...");
disconnect(0, !disconnecting);
}
string ctext;
void
toserver(OFString *text)
{
@autoreleasepool {
conoutf(@"%s:\f %@", player1->name, text);
strn0cpy(ctext, text.UTF8String, 80);
}
}
void
echo(OFString *text)
{
conoutf(@"%@", text);
}
|
|
<
|
|
<
|
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
disconnect();
return;
}
conoutf(@"attempting to disconnect...");
disconnect(0, !disconnecting);
}
static OFString *ctext;
void
toserver(OFString *text)
{
conoutf(@"%s:\f %@", player1->name, text);
ctext = text;
}
void
echo(OFString *text)
{
conoutf(@"%@", text);
}
|
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
}
int lastupdate = 0, lastping = 0;
OFString *toservermap;
bool senditemstoserver =
false; // after a map change, since server doesn't have map data
string clientpassword;
void
password(OFString *p)
{
@autoreleasepool {
strcpy_s(clientpassword, p.UTF8String);
}
}
COMMAND(password, ARG_1STR)
bool
netmapstart()
{
senditemstoserver = true;
return clienthost != NULL;
};
void
initclientnet()
{
ctext[0] = 0;
toservermap = @"";
clientpassword[0] = 0;
newname(@"unnamed");
newteam(@"red");
}
void
sendpackettoserv(void *packet)
{
|
|
<
|
<
<
>
|
|
|
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
}
int lastupdate = 0, lastping = 0;
OFString *toservermap;
bool senditemstoserver =
false; // after a map change, since server doesn't have map data
OFString *clientpassword;
void
password(OFString *p)
{
clientpassword = p;
}
COMMAND(password, ARG_1STR)
bool
netmapstart()
{
senditemstoserver = true;
return clienthost != NULL;
}
void
initclientnet()
{
ctext = @"";
toservermap = @"";
clientpassword = @"";
newname(@"unnamed");
newteam(@"red");
}
void
sendpackettoserv(void *packet)
{
|
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
|
putint(p, SV_ITEMLIST);
if (!m_noitems)
putitems(p);
putint(p, -1);
senditemstoserver = false;
serveriteminitdone = true;
}
if (ctext[0]) // player chat, not flood protected for
// now
{
packet->flags = ENET_PACKET_FLAG_RELIABLE;
putint(p, SV_TEXT);
sendstring(@(ctext), p);
ctext[0] = 0;
}
if (!c2sinit) // tell other clients who I am
{
packet->flags = ENET_PACKET_FLAG_RELIABLE;
c2sinit = true;
putint(p, SV_INITC2S);
sendstring(@(player1->name), p);
|
|
|
<
|
|
|
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
putint(p, SV_ITEMLIST);
if (!m_noitems)
putitems(p);
putint(p, -1);
senditemstoserver = false;
serveriteminitdone = true;
}
// player chat, not flood protected for now
if (ctext.length > 0) {
packet->flags = ENET_PACKET_FLAG_RELIABLE;
putint(p, SV_TEXT);
sendstring(ctext, p);
ctext = @"";
}
if (!c2sinit) // tell other clients who I am
{
packet->flags = ENET_PACKET_FLAG_RELIABLE;
c2sinit = true;
putint(p, SV_INITC2S);
sendstring(@(player1->name), p);
|