From a7e95d7818a12f41e94ae4b5951fc8ebb79cc75b Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Fri, 14 Apr 2023 19:40:51 -0400 Subject: [PATCH] [Cleanup] Delete embxs.cpp/embxs.h (#3284) * [Cleanup] Delete embxs.cpp/embxs.h # Notes - These files and the one method in them are unused. * Update embperl.cpp --- zone/CMakeLists.txt | 3 -- zone/embparser_api.cpp | 2 - zone/embperl.cpp | 41 ++++++++++++++++++ zone/embxs.cpp | 95 ------------------------------------------ zone/embxs.h | 7 ---- 5 files changed, 41 insertions(+), 107 deletions(-) delete mode 100644 zone/embxs.cpp delete mode 100644 zone/embxs.h diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index d5ad9a67e..b7d6590fc 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -32,7 +32,6 @@ SET(zone_sources embparser.cpp embparser_api.cpp embperl.cpp - embxs.cpp encounter.cpp entity.cpp exp.cpp @@ -77,7 +76,6 @@ SET(zone_sources lua_spell.cpp lua_stat_bonuses.cpp embperl.cpp - embxs.cpp entity.cpp exp.cpp fearpath.cpp @@ -186,7 +184,6 @@ SET(zone_headers dynamic_zone.h embparser.h embperl.h - embxs.h encounter.h entity.h errmsg.h diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 4284e22ff..1ee52bf65 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -27,7 +27,6 @@ #include "dialogue_window.h" #include "embperl.h" -#include "embxs.h" #include "entity.h" #include "expedition.h" #include "queryserv.h" @@ -4513,7 +4512,6 @@ void perl_register_quest() package.add("getfactionname", &Perl__getfactionname); package.add("getinventoryslotid", &Perl__getinventoryslotid); package.add("getitemname", &Perl__getitemname); - package.add("getItemName", &Perl__qc_getItemName); package.add("getitemstat", &Perl__getitemstat); package.add("getlanguagename", &Perl__getlanguagename); package.add("getldonthemename", &Perl__getldonthemename); diff --git a/zone/embperl.cpp b/zone/embperl.cpp index 781176526..cedae7ac8 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -322,6 +322,47 @@ bool Embperl::VarExists(const char *package, const char *var) { return(hv_exists(stash, var, len)); } +#ifdef EMBPERL_IO_CAPTURE + +XS(XS_EQEmuIO_PRINT); /* prototype to pass -Wmissing-prototypes */ +XS(XS_EQEmuIO_PRINT) +{ + dXSARGS; + if (items < 2) { + return; + } + + for (int r = 1; r < items; r++) { + char *str = SvPV_nolen(ST(r)); + char *cur = str; + + /* Strip newlines from log message 'str' */ + *std::remove(str, str + strlen(str), '\n') = '\0'; + + std::string log_string = str; + + if ( + log_string.find("did not return a true") != std::string::npos || + log_string.find("is experimental") != std::string::npos + ) { + return; + } + + for (int i = 0; *cur != '\0'; i++, cur++) { + if (*cur == '\n') { + LogQuests("{}", str); + } + } + + if (!log_string.empty()) { + LogQuests("{}", log_string); + } + } + + XSRETURN_EMPTY; +} + +#endif //EMBPERL_IO_CAPTURE #endif //EMBPERL diff --git a/zone/embxs.cpp b/zone/embxs.cpp deleted file mode 100644 index 71fcd932c..000000000 --- a/zone/embxs.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.org) - - 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 EMBPERL - -#include "../common/global_define.h" -#include "../common/eqemu_logsys.h" -#include "embxs.h" -#include "embperl.h" -#include "masterentity.h" -#include "command.h" - -const char *getItemName(unsigned itemid) -{ - const EQ::ItemData* item = nullptr; - item = database.GetItem(itemid); - - if (item) - return item->Name; - else - return nullptr; -} - -const char* Perl__qc_getItemName(unsigned itemid) -{ - return getItemName(itemid); // possible nullptr return -} - -#ifdef EMBPERL_IO_CAPTURE - -XS(XS_EQEmuIO_PRINT); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EQEmuIO_PRINT) -{ - dXSARGS; - if (items < 2) - return; -// Perl_croak(aTHX_ "Usage: EQEmuIO::PRINT(@strings)"); - - int r; - for (r = 1; r < items; r++) { - char *str = SvPV_nolen(ST(r)); - char *cur = str; - - /* Strip newlines from log message 'str' */ - *std::remove(str, str + strlen(str), '\n') = '\0'; - - std::string log_string = str; - - if (log_string.find("did not return a true") != std::string::npos) { - return; - } - - if (log_string.find("is experimental") != std::string::npos) { - return; - } - - int i; - int pos = 0; - int len = 0; - - for (i = 0; *cur != '\0'; i++, cur++) { - if (*cur == '\n') { - LogQuests("{}", str); - len = 0; - pos = i + 1; - } - else { - len++; - } - } - if (!log_string.empty()) { - LogQuests("{}", log_string); - } - } - - XSRETURN_EMPTY; -} -#endif //EMBPERL_IO_CAPTURE - -#endif // EMBPERL diff --git a/zone/embxs.h b/zone/embxs.h deleted file mode 100644 index 22f294ca6..000000000 --- a/zone/embxs.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef EMBXS_H -#define EMBXS_H - -const char *getItemName(unsigned itemid); -const char* Perl__qc_getItemName(unsigned itemid); - -#endif // EMBXS_H