shutdown.c

MudOSa4DGD/mudlib/dgd/sfun/shutdown.c · 1.3 KB

From the archive MudOSa4DGD-30.06.98.tar.gz

Download the archive   « Back to the archive contents

/*
 * shutdown.c
 *
 * SFUN: shutdown the mud
 *
 * (C) Frank Schmidt, Jesus@NorseMUD
 *
 */

#include <std.h>
#include <levels.h>

static varargs void shutdown(int exitcode) {
  object *usr;
  int i;

  if (DRIVER->query_driver_state()) {
    /* Driver managed to startup, perform deinitialization */
#if 0
    if (!DRIVER_PRIV() && (((file_name() != D_SHUTDOWN) && ((this_player() && 
	this_player()->query_level() < LESSER_GOD))) || !this_player())) {
      illegal();
      if (this_player()) {
	message("info", "\nDGD driver falls down boggling, while shutting d...\n", this_player());
	this_player()->__DESTROY_DEF();
      }
      /* we didn't shutdown the mud */
      return;
    }
    
    /* log the event */
    catch(log_file("SYSLOG", "shutdown: The mud is shutdown by " +
		   (this_player() ? (this_player()->query_real_name() + "(" +
				     file_name(this_player()) + ")") :
		    file_name()) + "\n"));
    
#endif

    /* last second actions before shutdown */
    for (i=a_sizeof(usr=users()); --i >= 0; )
      catch(usr[i]->save_me(1));

    /* notify users */
    catch(message("info", "\nDGD falls down boggling, while shutting d...\n", users()));
  }
    
  /* notify driver object */
  catch(DRIVER->do_shutdown(exitcode));

  /* Do It! */
  ::shutdown();
}

Site Stats

Snippets: 1791
Codebases: 571