-/* $Id: client.c,v 1.4 2014/06/19 19:53:34 mmondor Exp $ */
+/* $Id: client.c,v 1.5 2014/06/22 10:24:29 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <arpa/inet.h>
#include <client.h>
#include <kqueue.h>
if (c->ship.torps > 0)
continue;
+ syslog(LOG_NOTICE, "Disconnect [%s], id %d",
+ inet_ntoa(((struct sockaddr_in *)(&c->saddr))->sin_addr),
+ c->fd);
+
/* Closing descriptor automatically deletes its kevents */
(void) close(c->fd);
-/* $Id: kqueue.c,v 1.2 2014/06/19 18:22:03 mmondor Exp $ */
+/* $Id: kqueue.c,v 1.3 2014/06/22 10:24:29 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
#include <packets_common.h>
#include <packets.h>
#include <net.h>
+#include <arpa/inet.h>
#include <conf.h>
&saddrl)) == -1)
continue;
+ syslog(LOG_NOTICE,
+ "Connection from [%s], id %d",
+ inet_ntoa(((struct sockaddr_in *)
+ &saddr)->sin_addr), fd);
if ((c = client_create(fd, &saddr))
== NULL) {
(void) close(fd);
-/* $Id: ships.c,v 1.2 2014/06/21 17:16:32 mmondor Exp $ */
+/* $Id: ships.c,v 1.3 2014/06/22 10:24:30 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
/* XXX Random position/angle for now */
s->angle = s->i_angle = (random() % 255);
+ s->x = d->radius + (random() % (int)(WORLD_X_MAX - (d->radius * 2) - 1));
+ s->y = d->radius + (random() % (int)(WORLD_Y_MAX - (d->radius * 2) - 1));
/*
- s->x = d->radius + (random() % (WORLD_X_MAX - (d->radius * 2) - 1));
- s->y = d->radius + (random() % (WORLD_Y_MAX - (d->radius * 2) - 1));
- XXX
- */
s->x = WORLD_X_MAX / 2;
s->y = WORLD_Y_MAX / 2;
+ */
}
void