// *************************************************************** // Function: Shutdown.cpp // *************************************************************** #include "Main.h" #include "ConsoleScripts.h" void Icc_CleanUp(); //************************************ // Name: Shutdown // // Cleans up the server. // // Parameters: // // Return: // //************************************ int Shutdown() { gDatabase.Update(); gCoreLog.Section("Shutting down..."); //Remove all instances gInstances.clear(); gInstanceIds.FreeAll(); gCoreLog.Section("Shutting down the Game server..."); if (gpGameServer!=NULL) { gpGameServer->Shutdown(true); delete gpGameServer; //close our network server } gCoreLog.SectionOk(); gCoreLog.Section("Shutting down the Internal Communications client..."); if (gpInternalComm!=NULL) { gpInternalComm->Shutdown(true); delete gpInternalComm; //close our network server } gCoreLog.SectionOk(); if (GameServInfo.size()>0) GameServInfo.clear(); //erase server side client information not dealing with the network if (gInstances.size()>0) gInstances.clear(); Icc_CleanUp(); if (gpScriptMan!=NULL) { gCoreLog.Section("Shutting down scripting subsystem..."); delete gpScriptMan; gCoreLog.SectionOk(); } //Remove all registered console scripts list::iterator itr; for (itr=gConsoleCommands.begin(); itr!=gConsoleCommands.end(); itr++) { delete *itr; } //Remove the group permissions stuff if (gpPermissionGroups!=NULL){delete gpPermissionGroups;} gScriptLog.Close(); gCoreLog.debug("Closing this log..."); gCoreLog.SectionOk(); gCoreLog.Close(); //close the log file we opened gShutdownOK=true; //tell the server we can shut down. return 0; }