You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bomberclone/src/debug.c

53 lines
1.2 KiB

#include "bomberclone.h"
#include "network.h"
#include "packets.h"
int debug;
void d_gamedetail (char *head) {
d_playerdetail (head);
d_printf ("bman.players_nr = %d\n", bman.players_nr);
d_printf ("bman.players_nr_s = %d\n", bman.players_nr_s);
d_printf ("bman.gametype = %d\n", bman.gametype);
d_printf ("bman.multitype = %d\n", bman.multitype);
d_printf ("bman.state = %d\n", bman.state);
};
void d_printf (char *fmt,...) {
va_list args;
if (debug == 0)
return;
va_start (args, fmt);
fprintf (stdout, "[%8d] :", timestamp);
vfprintf (stdout, fmt, args);
va_end (args);
};
void d_playerdetail (char *head) {
int i;
d_printf ("---------------> %s\n", head);
d_printf ("Nr Name GFX Sta Pkt Win [Addr]\n");
for (i = 0; i < MAX_PLAYERS; i++)
d_printf ("%2d %16s %3d %3d %3d %3d [%s:%s]\n",i, bman.players[i].name, bman.players[i].gfx_nr, bman.players[i].state, bman.players[i].points, bman.players[i].wins, bman.players[i].net.addr.host, bman.players[i].net.addr.port);
};
void d_bitprint (int bits, int nr) {
int i;
for (i = nr-1; i >= 0; i--)
if ((bits & (1 << i)) == 0)
printf ("-");
else
printf ("X");
printf (" ");
};