Cube  Diff

Differences From Artifact [6783fe61cf]:

To Artifact [edb3579f73]:


368
369
370
371
372
373
374

375
376

377
378
379
380
381
382
383
384
385
386

387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410


411

412
		loadgamerest(); // hack
}

void
gets2c() // get updates from the server
{
	ENetEvent event;

	if (!clienthost)
		return;

	if (connecting && lastmillis / 3000 > connecting / 3000) {
		conoutf(@"attempting to connect...");
		connecting = lastmillis;
		++connattempts;
		if (connattempts > 3) {
			conoutf(@"could not connect to server");
			disconnect(false, false);
			return;
		}
	}

	while (
	    clienthost != NULL && enet_host_service(clienthost, &event, 0) > 0)
		switch (event.type) {
		case ENET_EVENT_TYPE_CONNECT:
			conoutf(@"connected to server");
			connecting = 0;
			throttle();
			break;

		case ENET_EVENT_TYPE_RECEIVE:
			if (disconnecting)
				conoutf(@"attempting to disconnect...");
			else
				localservertoclient(event.packet->data,
				    event.packet->dataLength);
			enet_packet_destroy(event.packet);
			break;

		case ENET_EVENT_TYPE_DISCONNECT:
			if (disconnecting)
				disconnect(false, false);
			else
				server_err();
			return;


		}

}






>


>



|
|





>
|
|






<








<






>
>

>

368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397

398
399
400
401
402
403
404
405

406
407
408
409
410
411
412
413
414
415
416
		loadgamerest(); // hack
}

void
gets2c() // get updates from the server
{
	ENetEvent event;

	if (!clienthost)
		return;

	if (connecting && lastmillis / 3000 > connecting / 3000) {
		conoutf(@"attempting to connect...");
		connecting = lastmillis;

		if (++connattempts > 3) {
			conoutf(@"could not connect to server");
			disconnect(false, false);
			return;
		}
	}

	while (clienthost != NULL &&
	    enet_host_service(clienthost, &event, 0) > 0) {
		switch (event.type) {
		case ENET_EVENT_TYPE_CONNECT:
			conoutf(@"connected to server");
			connecting = 0;
			throttle();
			break;

		case ENET_EVENT_TYPE_RECEIVE:
			if (disconnecting)
				conoutf(@"attempting to disconnect...");
			else
				localservertoclient(event.packet->data,
				    event.packet->dataLength);
			enet_packet_destroy(event.packet);
			break;

		case ENET_EVENT_TYPE_DISCONNECT:
			if (disconnecting)
				disconnect(false, false);
			else
				server_err();
			return;
		case ENET_EVENT_TYPE_NONE:
			break;
		}
	}
}