void process_message (void) { int bytes, pos = 4; long scount; if (!SocketReadable (sock)) return; GetSocketError (sock); if ((bytes = DgramReceiveAny (sock, (char *) ibuffer, BUFFERSIZE)) <= 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || bytes >= 0) { GetSocketError (sock); return; } CQuit ("Can't receive server's message\n"); SocketClose (sock); } GETLONG (ibuffer, scount); csetrrcount (scount); while (pos + 2 < bytes) { int size; GETSHORT (ibuffer + pos, size); if (pos + size <= bytes) { ctable[ibuffer[pos + 2]].func ((ibuffer + pos + 3), size - 3); } pos += size; } }
static void quit () { #ifdef NETSUPPORT if (client) CQuit ("Selected quit in main menu"); #endif uninitialize (); exit (0); }
static void coutro (unsigned char *message, int size) { outro2 (); CQuit ("End of game\nBye"); }