From d1572790b16361c43a9962d9bda18d084bc866f1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 04:15:26 -0600 Subject: [PATCH] Remove eqemu_error.cpp/.h as they are useless --- common/CMakeLists.txt | 2 - common/eqemu_error.cpp | 135 ----------------------------------------- common/eqemu_error.h | 36 ----------- world/net.cpp | 3 +- zone/net.cpp | 7 +-- 5 files changed, 2 insertions(+), 181 deletions(-) delete mode 100644 common/eqemu_error.cpp delete mode 100644 common/eqemu_error.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 934a4b7b9..4e5791330 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -18,7 +18,6 @@ SET(common_sources eqdb_res.cpp eqemu_exception.cpp eqemu_config.cpp - eqemu_error.cpp eqemu_logsys.cpp eq_packet.cpp eq_stream.cpp @@ -119,7 +118,6 @@ SET(common_headers eqemu_exception.h eqemu_config.h eqemu_config_elements.h - eqemu_error.h eqemu_logsys.h eq_packet.h eq_stream.h diff --git a/common/eqemu_error.cpp b/common/eqemu_error.cpp deleted file mode 100644 index ff9a7bbd6..000000000 --- a/common/eqemu_error.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY except by those people which sell it, which - are required to give you total support for your newly bought product; - without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifdef _WINDOWS -#include -#endif -#include "eqemu_error.h" -#include "linked_list.h" -#include "mutex.h" -#include "misc_functions.h" -#include -#include -#ifdef _WINDOWS - #include -#endif - -void UpdateWindowTitle(char* iNewTitle = 0); -void CatchSignal(int sig_num); - -const char* EQEMuErrorText[EQEMuError_MaxErrorID] = { "ErrorID# 0, No Error", - "MySQL Error #1405 or #2001 means your mysql server rejected the username and password you presented it.", - "MySQL Error #2003 means you were unable to connect to the mysql server.", - "MySQL Error #2005 means you there are too many connections on the mysql server. The server is overloaded.", - "MySQL Error #2007 means you the server is out of memory. The server is overloaded.", - }; - -LinkedList* EQEMuErrorList; -Mutex* MEQEMuErrorList; -AutoDelete< LinkedList > ADEQEMuErrorList(&EQEMuErrorList); -AutoDelete ADMEQEMuErrorList(&MEQEMuErrorList); - -const char* GetErrorText(uint32 iError) { - if (iError >= EQEMuError_MaxErrorID) - return "ErrorID# out of range"; - else - return EQEMuErrorText[iError]; -} - -void AddEQEMuError(eEQEMuError iError, bool iExitNow) { - if (!iError) - return; - if (!EQEMuErrorList) { - EQEMuErrorList = new LinkedList; - MEQEMuErrorList = new Mutex; - } - LockMutex lock(MEQEMuErrorList); - - LinkedListIterator iterator(*EQEMuErrorList); - iterator.Reset(); - while (iterator.MoreElements()) { - if (iterator.GetData()[0] == 1) { -//Umm... this gets a big WTF... -// if (*((uint32*) iterator.GetData()[1]) == iError) -//not sure whats going on, using a character as a pointer.... - if (*((eEQEMuError*) &(iterator.GetData()[1])) == iError) - return; - } - iterator.Advance(); - } - - char* tmp = new char[6]; - tmp[0] = 1; - tmp[5] = 0; - *((uint32*) &tmp[1]) = iError; - EQEMuErrorList->Append(tmp); - - if (iExitNow) - CatchSignal(2); -} - -void AddEQEMuError(char* iError, bool iExitNow) { - if (!iError) - return; - if (!EQEMuErrorList) { - EQEMuErrorList = new LinkedList; - MEQEMuErrorList = new Mutex; - } - LockMutex lock(MEQEMuErrorList); - char* tmp = strcpy(new char[strlen(iError) + 1], iError); - EQEMuErrorList->Append(tmp); - - if (iExitNow) - CatchSignal(2); -} - -uint32 CheckEQEMuError() { - if (!EQEMuErrorList) - return 0; - uint32 ret = 0; - char* tmp = 0; - bool HeaderPrinted = false; - LockMutex lock(MEQEMuErrorList); - - while ((tmp = EQEMuErrorList->Pop() )) { - if (!HeaderPrinted) { - fprintf(stdout, "===============================\nRuntime errors:\n\n"); - HeaderPrinted = true; - } - if (tmp[0] == 1) { - fprintf(stdout, "%s\n", GetErrorText(*((uint32*) &tmp[1]))); - fprintf(stdout, "For more information on this error, visit http://www.eqemu.net/eqemuerror.php?id=%u\n\n", *((uint32*) &tmp[1])); - } - else { - fprintf(stdout, "%s\n\n", tmp); - } - safe_delete(tmp); - ret++; - } - return ret; -} - -void CheckEQEMuErrorAndPause() { -#ifdef _WINDOWS - if (CheckEQEMuError()) { - fprintf(stdout, "Hit any key to exit\n"); - UpdateWindowTitle("Error"); - getch(); - } -#endif -} - diff --git a/common/eqemu_error.h b/common/eqemu_error.h deleted file mode 100644 index ffc5d69ed..000000000 --- a/common/eqemu_error.h +++ /dev/null @@ -1,36 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY except by those people which sell it, which - are required to give you total support for your newly bought product; - without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef EQEMuError_H -#define EQEMuError_H - -#include "../common/types.h" - -enum eEQEMuError { EQEMuError_NoError, - EQEMuError_Mysql_1405, - EQEMuError_Mysql_2003, - EQEMuError_Mysql_2005, - EQEMuError_Mysql_2007, - EQEMuError_MaxErrorID }; - -void AddEQEMuError(eEQEMuError iError, bool iExitNow = false); -void AddEQEMuError(char* iError, bool iExitNow = false); -uint32 CheckEQEMuError(); -void CheckEQEMuErrorAndPause(); - -#endif - diff --git a/world/net.cpp b/world/net.cpp index 8914415a4..529643d08 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -34,7 +34,7 @@ #include "../common/version.h" #include "../common/eqtime.h" #include "../common/timeoutmgr.h" -#include "../common/eqemu_error.h" + #include "../common/opcodemgr.h" #include "../common/guilds.h" #include "../common/eq_stream_ident.h" @@ -498,7 +498,6 @@ int main(int argc, char** argv) { Log.Out(Logs::Detail, Logs::World_Server,"Signaling HTTP service to stop..."); http_server.Stop(); - CheckEQEMuErrorAndPause(); return 0; } diff --git a/zone/net.cpp b/zone/net.cpp index a299da25a..ab2e06871 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -28,7 +28,7 @@ #include "../common/eq_packet_structs.h" #include "../common/mutex.h" #include "../common/version.h" -#include "../common/eqemu_error.h" + #include "../common/packet_dump_file.h" #include "../common/opcodemgr.h" #include "../common/guilds.h" @@ -221,19 +221,16 @@ int main(int argc, char** argv) { Log.Out(Logs::Detail, Logs::Zone_Server, "Loading npc faction lists"); if (!database.LoadNPCFactionLists()) { Log.Out(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!"); - CheckEQEMuErrorAndPause(); return 1; } Log.Out(Logs::Detail, Logs::Zone_Server, "Loading loot tables"); if (!database.LoadLoot()) { Log.Out(Logs::General, Logs::Error, "Loading loot FAILED!"); - CheckEQEMuErrorAndPause(); return 1; } Log.Out(Logs::Detail, Logs::Zone_Server, "Loading skill caps"); if (!database.LoadSkillCaps()) { Log.Out(Logs::General, Logs::Error, "Loading skill caps FAILED!"); - CheckEQEMuErrorAndPause(); return 1; } @@ -244,7 +241,6 @@ int main(int argc, char** argv) { Log.Out(Logs::Detail, Logs::Zone_Server, "Loading base data"); if (!database.LoadBaseData()) { Log.Out(Logs::General, Logs::Error, "Loading base data FAILED!"); - CheckEQEMuErrorAndPause(); return 1; } @@ -512,7 +508,6 @@ int main(int argc, char** argv) { safe_delete(taskmanager); command_deinit(); safe_delete(parse); - CheckEQEMuErrorAndPause(); Log.Out(Logs::Detail, Logs::Zone_Server, "Proper zone shutdown complete."); return 0; }