diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/Makefile.in | 9 | ||||
-rw-r--r-- | src/map/atcommand.c | 18 | ||||
-rw-r--r-- | src/map/battle.c | 8 | ||||
-rw-r--r-- | src/map/map.c | 3 | ||||
-rw-r--r-- | src/map/pc.c | 10 | ||||
-rw-r--r-- | src/map/script.c | 17 |
6 files changed, 24 insertions, 41 deletions
diff --git a/src/map/Makefile.in b/src/map/Makefile.in index e3a47abeb..e4f2d9953 100644 --- a/src/map/Makefile.in +++ b/src/map/Makefile.in @@ -1,9 +1,12 @@ +# Copyright (c) Hercules Dev Team, licensed under GNU GPL. +# See the LICENSE file CONFIG_D = ../config CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h) COMMON_D = ../common COMMON_H = $(wildcard $(COMMON_D)/*.h) +SYSINFO_INC = $(COMMON_D)/sysinfo.inc LIBCONFIG_D = ../../3rdparty/libconfig LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \ @@ -33,7 +36,7 @@ MAP_H = atcommand.h battle.h battleground.h buyingstore.h chat.h chrif.h \ HAVE_MYSQL=@HAVE_MYSQL@ ifeq ($(HAVE_MYSQL),yes) - MAP_SERVER_SQL_DEPENDS=$(MAP_OBJ) $(COMMON_D)/obj_sql/common_sql.a $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) + MAP_SERVER_SQL_DEPENDS=$(MAP_OBJ) $(COMMON_D)/obj_sql/common_sql.a $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ $(SYSINFO_INC)) else MAP_SERVER_SQL_DEPENDS=needs_mysql endif @@ -79,6 +82,10 @@ help: Makefile: Makefile.in @$(MAKE) -C ../.. src/map/Makefile +$(SYSINFO_INC): $(MAP_C) $(MAP_H) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) + @echo " MAKE $@" + @$(MAKE) -C ../.. sysinfo + needs_mysql: @echo "MySQL not found or disabled by the configure script" @exit 1 diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 9e33f3c68..6668214fa 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -14,6 +14,7 @@ #include "../common/strlib.h" #include "../common/utils.h" #include "../common/conf.h" +#include "../common/sysinfo.h" #include "atcommand.h" #include "battle.h" @@ -7208,18 +7209,11 @@ ACMD(whereis) } ACMD(version) { - const char *git = get_git_hash(); - const char *svn = get_svn_revision(); - - if ( git[0] != HERC_UNKNOWN_VER ) { - sprintf(atcmd_output,msg_txt(1295),git); // Git Hash '%s' - clif->message(fd,atcmd_output); - } else if ( svn[0] != HERC_UNKNOWN_VER ) { - sprintf(atcmd_output,msg_txt(1294),git); // SVN r%s - clif->message(fd,atcmd_output); - } else - clif->message(fd,msg_txt(1296)); // Cannot determine version - + sprintf(atcmd_output, msg_txt(1296), sysinfo->is64bit() ? 64 : 32, sysinfo->platform()); // Hercules %d-bit for %s + clif->message(fd, atcmd_output); + sprintf(atcmd_output, msg_txt(1295), sysinfo->vcstype(), sysinfo->vcsrevision_src(), sysinfo->vcsrevision_scripts()); // %s revision '%s' (src) / '%s' (scripts) + clif->message(fd, atcmd_output); + return true; } diff --git a/src/map/battle.c b/src/map/battle.c index 2217ccecc..d64c14b2f 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -12,6 +12,7 @@ #include "../common/socket.h" #include "../common/strlib.h" #include "../common/utils.h" +#include "../common/sysinfo.h" #include "../common/HPM.h" #include "map.h" @@ -6748,8 +6749,6 @@ static const struct _battle_data { void Hercules_report(char* date, char *time_c) { int i, bd_size = ARRAYLENGTH(battle_data); unsigned int config = 0; - const char *svn = get_svn_revision(); - const char *git = get_git_hash(); char timestring[25]; time_t curtime; char* buf; @@ -6776,6 +6775,9 @@ void Hercules_report(char* date, char *time_c) { C_SEND_SHORTLIST = 0x40000, }; + // TODO[Haru]: Add sysinfo->platform(), sysinfo->osversion(), sysinfo->cpu(), sysinfo->arch(), + // sysinfo->vcstype(), sysinfo->vcsrevision_scripts() to the stat server + /* we get the current time */ time(&curtime); strftime(timestring, 24, "%Y-%m-%d %H:%M:%S", localtime(&curtime)); @@ -6867,7 +6869,7 @@ void Hercules_report(char* date, char *time_c) { safestrncpy((char*)WBUFP(buf,6 + 12), time_c, 9); safestrncpy((char*)WBUFP(buf,6 + 12 + 9), timestring, 24); - safestrncpy((char*)WBUFP(buf,6 + 12 + 9 + 24), git[0] != HERC_UNKNOWN_VER ? git : svn[0] != HERC_UNKNOWN_VER ? svn : "Unknown", 41); + safestrncpy((char*)WBUFP(buf,6 + 12 + 9 + 24), sysinfo->vcsrevision_src(), 41); WBUFL(buf,6 + 12 + 9 + 24 + 41) = map->getusers(); WBUFL(buf,6 + 12 + 9 + 24 + 41 + 4) = config; diff --git a/src/map/map.c b/src/map/map.c index a423e6973..7adeee3d5 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5373,9 +5373,6 @@ void map_helpscreen(bool do_exit) * Map-Server Version Screen [MC Cameri] *------------------------------------------------------*/ void map_versionscreen(bool do_exit) { - const char *svn = get_svn_revision(); - const char *git = get_git_hash(); - ShowInfo(CL_WHITE"Hercules version: %s" CL_RESET"\n", git[0] != HERC_UNKNOWN_VER ? git : svn[0] != HERC_UNKNOWN_VER ? svn : "Unknown"); ShowInfo(CL_GREEN"Website/Forum:"CL_RESET"\thttp://hercules.ws/\n"); ShowInfo(CL_GREEN"IRC Channel:"CL_RESET"\tirc://irc.rizon.net/#Hercules\n"); ShowInfo("Open "CL_WHITE"readme.txt"CL_RESET" for more information.\n"); diff --git a/src/map/pc.c b/src/map/pc.c index 848238ed2..afb06527d 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -14,6 +14,7 @@ #include "../common/utils.h" #include "../common/conf.h" #include "../common/mmo.h" //NAME_LENGTH +#include "../common/sysinfo.h" #include "pc.h" #include "atcommand.h" // get_atcommand_level() @@ -1147,15 +1148,8 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim if( !changing_mapservers ) { if (battle_config.display_version == 1) { - const char* svn = get_svn_revision(); - const char* git = get_git_hash(); char buf[256]; - if( git[0] != HERC_UNKNOWN_VER ) - sprintf(buf,"Git Hash: %s", git); - else if( svn[0] != HERC_UNKNOWN_VER ) - sprintf(buf,"SVN Revision: %s", svn); - else - sprintf(buf,"Unknown Version"); + sprintf(buf, msg_txt(1295), sysinfo->vcstype(), sysinfo->vcsrevision_src(), sysinfo->vcsrevision_scripts()); // %s revision '%s' (src) / '%s' (scripts) clif->message(sd->fd, buf); } diff --git a/src/map/script.c b/src/map/script.c index 312e40696..8ac657f93 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12,6 +12,7 @@ #include "../common/strlib.h" #include "../common/timer.h" #include "../common/utils.h" +#include "../common/sysinfo.h" #include "map.h" #include "path.h" @@ -4499,6 +4500,8 @@ int script_reload(void) { itemdb->name_constants(); + sysinfo->vcsrevision_reload(); + return 0; } /* returns name of current function being run, from within the stack [Ind/Hercules] */ @@ -17315,19 +17318,6 @@ BUILDIN(is_function) { return true; } /** - * get_revision() -> retrieves the current svn revision (if available) - **/ -BUILDIN(get_revision) { - const char *svn = get_svn_revision(); - - if ( svn[0] != HERC_UNKNOWN_VER ) - script_pushint(st,atoi(svn)); - else - script_pushint(st,-1);//unknown - - return true; -} -/** * freeloop(<toggle>) -> toggles this script instance's looping-check ability **/ BUILDIN(freeloop) { @@ -19152,7 +19142,6 @@ void script_parse_builtin(void) { BUILDIN_DEF(getargcount,""), BUILDIN_DEF(getcharip,"?"), BUILDIN_DEF(is_function,"s"), - BUILDIN_DEF(get_revision,""), BUILDIN_DEF(freeloop,"i"), BUILDIN_DEF(getrandgroupitem,"ii"), BUILDIN_DEF(cleanmap,"s"), |