1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcsid_loop_c = |
3 | * static char *rcsid_loop_c = |
4 | * "$Id: loop.c,v 1.7 2006/04/28 16:24:03 root Exp $"; |
4 | * "$Id: loop.c,v 1.10 2006/07/01 21:06:26 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
114 | { "lookat", LookAt, 1}, |
114 | { "lookat", LookAt, 1}, |
115 | { "lock", (func_uint8_int_pl)LockItem, 1}, |
115 | { "lock", (func_uint8_int_pl)LockItem, 1}, |
116 | { "mark", (func_uint8_int_pl)MarkItem, 1}, |
116 | { "mark", (func_uint8_int_pl)MarkItem, 1}, |
117 | { "mapredraw", MapRedrawCmd, 0}, /* Added: phil */ |
117 | { "mapredraw", MapRedrawCmd, 0}, /* Added: phil */ |
118 | { "mapinfo", MapInfoCmd, 2}, /* CF+ */ |
118 | { "mapinfo", MapInfoCmd, 2}, /* CF+ */ |
|
|
119 | { "ext", ExtCmd, 2}, /* CF+ */ |
119 | { NULL, NULL, 0} /* terminator */ |
120 | { NULL, NULL, 0} /* terminator */ |
120 | }; |
121 | }; |
121 | |
122 | |
122 | /** Face-related commands */ |
123 | /** Face-related commands */ |
123 | static struct NsCmdMapping nscommands[] = { |
124 | static struct NsCmdMapping nscommands[] = { |
… | |
… | |
365 | ns->status =Ns_Dead; |
366 | ns->status =Ns_Dead; |
366 | return; |
367 | return; |
367 | } |
368 | } |
368 | /* Still dont have a full packet */ |
369 | /* Still dont have a full packet */ |
369 | if (i==0) return; |
370 | if (i==0) return; |
|
|
371 | |
|
|
372 | // //D//TODO//temporarily log long commands |
|
|
373 | // if (ns->inbuf.len >= 40 && pl && pl->ob) |
|
|
374 | // LOG (llevDebug, "HandleClient: long comamnd from <%s,%s> %d<%s>\n", pl->ob->name, ns->host, ns->inbuf.len, ns->inbuf.buf + 2); |
370 | |
375 | |
371 | /* First, break out beginning word. There are at least |
376 | /* First, break out beginning word. There are at least |
372 | * a few commands that do not have any paremeters. If |
377 | * a few commands that do not have any paremeters. If |
373 | * we get such a command, don't worry about trying |
378 | * we get such a command, don't worry about trying |
374 | * to break it up. |
379 | * to break it up. |
… | |
… | |
511 | while (select(socket_info.max_filedescriptor, &readfs, NULL, NULL, &Timeout)==0); |
516 | while (select(socket_info.max_filedescriptor, &readfs, NULL, NULL, &Timeout)==0); |
512 | |
517 | |
513 | reset_sleep(); /* Or the game would go too fast */ |
518 | reset_sleep(); /* Or the game would go too fast */ |
514 | } |
519 | } |
515 | |
520 | |
|
|
521 | void flush_sockets(void) |
|
|
522 | { |
|
|
523 | player *pl; |
|
|
524 | |
|
|
525 | for (pl = first_player; pl != NULL; pl = pl->next) |
|
|
526 | if (pl->socket.status != Ns_Dead) |
|
|
527 | Socket_Flush (&pl->socket); |
|
|
528 | } |
516 | |
529 | |
517 | /** |
530 | /** |
518 | * This checks the sockets for input and exceptions, does the right thing. |
531 | * This checks the sockets for input and exceptions, does the right thing. |
519 | * |
532 | * |
520 | * A bit of this code is grabbed out of socket.c |
533 | * A bit of this code is grabbed out of socket.c |