#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <time.h> #if defined(macintosh) #include <types.h> #else #include <sys/types.h> #include <sys/time.h> #include <sys/resource.h> #endif #include "merc.h" #include "db.h" #include "recycle.h" #include "music.h" #include "tables.h" #include "lookup.h" #include "olc.h" #include "gdl.h" #include "bounty.h" #include "balance.h" #include "world.h" #include "religion.h" #include "gquest.h" /* * load_all() * * Simple utility to load and log all startup files excluding areas. */ void load_all() { log_string("\n\n -=-=-=-=-=- Vandagard is Starting up -=-=-=-=-=-\n\n"); log_string("*** AREA ******** Repairing and Fixing areas"); sort_areas_by_level (); convert_objects (); area_update (); log_string("*** NOTES ******* Loading note system"); load_boards(); save_notes(); log_string("*** BANS ******** Loading up Global mud bans"); load_bans (); log_string("*** SONGS ******* Loading up the jukebox"); load_songs (); log_string("*** CLASSES ***** Loading Class data"); load_classes(); log_string("*** WORLD ******* Loading World data"); load_world_data(); log_string("*** BOUNTY ****** Loading bounty data"); load_bounty(); log_string("*** DISABLED **** Loading Disabled data"); load_disabled(); log_string("*** TIME ******** Loading Time file"); load_time(); log_string("*** RELIGION **** Loading Religion data"); load_religions(); log_string("*** QUEST ******* Loading Quest Data"); load_quest(); log_string("*** QUEST ******* Loading Text Data"); load_gquest_text(); } /* * startup_bug() * * Function to write to a file all startup related bug issues, such as * fix_exits() and other such data that isnt critical to operation */ void startup_bug (const char *str, int param) { char buf[MAX_STRING_LENGTH]; FILE * fp; if ( ( fp = fopen( STARTUPBUG_FILE, "a" ) ) != NULL ) { fprintf( fp, "%s\n", buf ); fclose( fp ); } return; } void load_time() { long lhour, lday, lmonth; int total; bool fail=FALSE; /* Try and load time from file first */ FILE *fp; if ((fp = fopen (TIME_FILE, "r"))) { total=fscanf(fp, "%d %d %d %d", &(time_info.hour), &(time_info.day), &(time_info.month), &(time_info.year)); if (total < 4) { log_string ("loading stored time failed, using default"); fail=TRUE; } fclose (fp); } else { log_string ("failed open of time_file, loading default time."); fail=TRUE; } if (fail) { lhour = (current_time - 650336715) / (PULSE_TICK / PULSE_PER_SECOND); time_info.hour = lhour % 24; lday = lhour / 24; time_info.day = lday % 35; lmonth = lday / 35; time_info.month = lmonth % 17; time_info.year = lmonth / 17; } return; }