… | |
… | |
531 | abort (); |
531 | abort (); |
532 | else |
532 | else |
533 | _exit (0); |
533 | _exit (0); |
534 | } |
534 | } |
535 | |
535 | |
536 | void |
|
|
537 | leave (player *pl, int draw_exit) |
|
|
538 | { |
|
|
539 | if (pl) |
|
|
540 | { |
|
|
541 | if (pl->ob->type != DEAD_OBJECT) |
|
|
542 | { |
|
|
543 | /* If a hidden dm dropped connection do not create |
|
|
544 | * inconsistencies by showing that they have left the game |
|
|
545 | */ |
|
|
546 | if (!(QUERY_FLAG (pl->ob, FLAG_WIZ) && pl->ob->contr->hidden) |
|
|
547 | && draw_exit) |
|
|
548 | { |
|
|
549 | if (pl->ob->map) |
|
|
550 | { |
|
|
551 | INVOKE_PLAYER (LOGOUT, pl); |
|
|
552 | LOG (llevInfo, "LOGOUT: Player named %s from ip %s\n", &pl->ob->name, pl->ns->host); |
|
|
553 | } |
|
|
554 | |
|
|
555 | char buf[MAX_BUF]; |
|
|
556 | |
|
|
557 | sprintf (buf, "%s left the game.", &pl->ob->name); |
|
|
558 | new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, 0, buf); |
|
|
559 | } |
|
|
560 | |
|
|
561 | pl->ob->remove (); |
|
|
562 | pl->ob->type = DEAD_OBJECT; /* To avoid problems with inventory window */ |
|
|
563 | } |
|
|
564 | |
|
|
565 | /* We do this so that the socket handling routine can do the final |
|
|
566 | * cleanup. We also leave that loop to actually handle the freeing |
|
|
567 | * of the data. |
|
|
568 | */ |
|
|
569 | if (pl->ns) |
|
|
570 | pl->ns->destroy (); |
|
|
571 | |
|
|
572 | } |
|
|
573 | } |
|
|
574 | |
|
|
575 | int |
536 | int |
576 | forbid_play (void) |
537 | forbid_play (void) |
577 | { |
538 | { |
578 | #if !defined(_IBMR2) && !defined(___IBMR2) && defined(PERM_FILE) |
539 | #if !defined(_IBMR2) && !defined(___IBMR2) && defined(PERM_FILE) |
579 | char buf[MAX_BUF], day[MAX_BUF]; |
540 | char buf[MAX_BUF], day[MAX_BUF]; |
… | |
… | |
591 | |
552 | |
592 | while (fgets (buf, MAX_BUF, fp)) |
553 | while (fgets (buf, MAX_BUF, fp)) |
593 | { |
554 | { |
594 | if (buf[0] == '#') |
555 | if (buf[0] == '#') |
595 | continue; |
556 | continue; |
|
|
557 | |
596 | if (!strncmp (buf, "msg", 3)) |
558 | if (!strncmp (buf, "msg", 3)) |
597 | { |
559 | { |
598 | if (forbit) |
560 | if (forbit) |
599 | while (fgets (buf, MAX_BUF, fp)) /* print message */ |
561 | while (fgets (buf, MAX_BUF, fp)) /* print message */ |
600 | fputs (buf, logfile); |
562 | fputs (buf, logfile); |
601 | break; |
563 | break; |
602 | |
|
|
603 | } |
564 | } |
604 | else if (sscanf (buf, "%s %d%*c%d\n", day, &start, &stop) != 3) |
565 | else if (sscanf (buf, "%s %d%*c%d\n", day, &start, &stop) != 3) |
605 | { |
566 | { |
606 | LOG (llevDebug, "Warning: Incomplete line in permission file ignored.\n"); |
567 | LOG (llevDebug, "Warning: Incomplete line in permission file ignored.\n"); |
607 | continue; |
568 | continue; |
… | |
… | |
621 | return 0; |
582 | return 0; |
622 | #endif |
583 | #endif |
623 | } |
584 | } |
624 | |
585 | |
625 | /* |
586 | /* |
626 | * do_specials() is a collection of functions to call from time to time. |
587 | * do_specials() is a collection of functions to call from time to time. |
627 | * Modified 2000-1-14 MSW to use the global pticks count to determine how |
588 | * Modified 2000-1-14 MSW to use the global pticks count to determine how |
628 | * often to do things. This will allow us to spred them out more often. |
589 | * often to do things. This will allow us to spred them out more often. |
629 | * I use prime numbers for the factor count - in that way, it is less likely |
590 | * I use prime numbers for the factor count - in that way, it is less likely |
630 | * these actions will fall on the same tick (compared to say using 500/2500/15000 |
591 | * these actions will fall on the same tick (compared to say using 500/2500/15000 |
631 | * which would mean on that 15,000 tick count a whole bunch of stuff gets |
592 | * which would mean on that 15,000 tick count a whole bunch of stuff gets |