Cube  Diff

Differences From Artifact [2cc0559143]:

To Artifact [da4c60f968]:


160
161
162
163
164
165
166
167

168
169
170
171
172
173


174
175
176
177
178
179
180
181
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);
}

string ctext;
static OFString *ctext;
void
toserver(OFString *text)
{
	@autoreleasepool {
		conoutf(@"%s:\f %@", player1->name, text);
		strn0cpy(ctext, text.UTF8String, 80);
	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
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

string clientpassword;
OFString *clientpassword;
void
password(OFString *p)
{
	@autoreleasepool {
		strcpy_s(clientpassword, p.UTF8String);
	clientpassword = p;
	}
}
COMMAND(password, ARG_1STR)

bool
netmapstart()
{
	senditemstoserver = true;
	return clienthost != NULL;
};
}

void
initclientnet()
{
	ctext[0] = 0;
	ctext = @"";
	toservermap = @"";
	clientpassword[0] = 0;
	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
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;
			}
			if (ctext[0]) // player chat, not flood protected for
			              // now
			// 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[0] = 0;
				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);