Cube  Diff

Differences From Artifact [95faadaf28]:

To Artifact [043bbacb23]:


395
396
397
398
399
400
401


402
403

404
405
406
407
408
409
410
411
412
395
396
397
398
399
400
401
402
403
404

405


406
407
408
409
410
411
412







+
+

-
+
-
-







	mapend = lastsec + minremain * 60;
	interm = 0;
}

int nonlocalclients = 0;
int lastconnect = 0;

// main server update, called from cube main loop in sp, or dedicated server
// loop
void
serverslice(int seconds,
serverslice(int seconds, unsigned int timeout)
    unsigned int timeout) // main server update, called from cube main loop in
                          // sp, or dedicated server loop
{
	// spawn entities when timer reached
	[sents enumerateObjectsUsingBlock:
	    ^ (ServerEntity *e, size_t i, bool *stop) {
		if (e.spawnsecs && (e.spawnsecs -= seconds - lastsec) <= 0) {
			e.spawnsecs = 0;
			e.spawned = true;
468
469
470
471
472
473
474
475

476
477

478
479
480
481
482
483
484
468
469
470
471
472
473
474

475


476
477
478
479
480
481
482
483







-
+
-
-
+







		case ENET_EVENT_TYPE_CONNECT: {
			Client *c = addclient();
			c.type = ST_TCPIP;
			c.peer = event.peer;
			c.peer->data = (void *)(clients.count - 1);
			char hn[1024];
			c.hostname = (enet_address_get_host(
			                  &c.peer->address, hn, sizeof(hn)) == 0
			    &c.peer->address, hn, sizeof(hn)) == 0
			        ? @(hn)
			        : @"localhost");
			    ? @(hn) : @"localhost");
			[OFStdOut writeFormat: @"client connected (%@)\n",
					       c.hostname];
			send_welcome(lastconnect = clients.count - 1);
			break;
		}
		case ENET_EVENT_TYPE_RECEIVE:
			brec += event.packet->dataLength;