/** * Initializes the server. */ static void initialize() { // TODO Abfangen des Abbruchssignales und entsprechend darauf reagieren // Used to close via process signals //#if (defined __USE_UNIX98 || defined __FreeBSD__) // signal(SIGQUIT, closeGracefully); //#endif // signal(SIGINT, closeGracefully); // signal(SIGTERM, closeGracefully); //string logFile=Configuration.getValue("log_accountServerFile", DEFAULT_LOG_FILE); //// Initialize PhysicsFS ////PHYSFS_init(""); //Logger.Init(logFile); // Indicate in which file the statistics are put. statisticsFile=Configuration.getValue("log_statisticsFile", DEFAULT_STATS_FILE); Logger.Write(LogLevel.Information, "Using statistics file: {0}", statisticsFile); //ResourceManager::initialize(); //TODO Check // Open database //TODO wieder einkommentieren //#if! DEBUG // try // { //#endif storage=new Storage(); storage.open(); //#if! DEBUG // } // catch(Exception ex) // { // Logger.Add(LogLevel.Error, "Error opening the database: {0}", ex.ToString()); // System.Environment.Exit((int)ExitValue.EXIT_DB_EXCEPTION); // } //#endif // --- Initialize the managers stringFilter = new StringFilter(); // The slang's and double quotes filter. chatChannelManager=new ChatChannelManager(); guildManager=new GuildManager(); postalManager=new PostManager(); gBandwidth=new BandwidthMonitor(); // --- Initialize the global handlers // FIXME: Make the global handlers global vars or part of a bigger // singleton or a local variable in the event-loop chatHandler=new ChatHandler(); // Initialize the processor utility functions //utils::processor::init(); //TODO Überprüfen // Seed the random number generator //std::srand( time(NULL) ); //TODO Überprüfen }
static void initializeServer() { // Used to close via process signals //#if (defined __USE_UNIX98 || defined __FreeBSD__) // signal(SIGQUIT, closeGracefully); //#endif // signal(SIGINT, closeGracefully); // signal(SIGTERM, closeGracefully); // Initialize PhysicsFS //PHYSFS_init(""); // --- Initialize the managers // Initialize the slang's and double quotes filter. stringFilter=new StringFilter(); ResourceManager.initialize(); if(MapManager.initialize(DEFAULT_MAPSDB_FILE)<1) { Logger.Write(LogLevel.Fatal, "The Game Server can't find any valid/available maps."); System.Environment.Exit((int)ExitValue.EXIT_MAP_FILE_NOT_FOUND); } attributeManager.initialize(); skillManager.initialize(); itemManager.initialize(); monsterManager.initialize(); StatusManager.initialize(DEFAULT_STATUSDB_FILE); PermissionManager.initialize(DEFAULT_PERMISSION_FILE); string mainScriptFile=Configuration.getValue("script_mainFile", DEFAULT_GLOBAL_EVENT_SCRIPT_FILE); Script.loadGlobalEventScript(mainScriptFile); // Initialize the global handlers // FIXME: Make the global handlers global vars or part of a bigger // singleton or a local variable in the event-loop gameHandler=new GameHandler(); accountHandler=new AccountConnection(); postMan=new PostMan(); gBandwidth=new BandwidthMonitor(); }