From a5d231b6a60a4ab868918850be24640e88843825 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 16 Feb 2013 19:31:20 -0800 Subject: Rotate logs in background Also reenable the critical bonus effect. --- src/map/map.cpp | 23 +++++++++++++++++------ src/map/map.t.hpp | 2 -- src/map/pc.cpp | 2 -- 3 files changed, 17 insertions(+), 10 deletions(-) (limited to 'src/map') diff --git a/src/map/map.cpp b/src/map/map.cpp index 6ed7662..d7cf4f6 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -1,8 +1,10 @@ #include "map.hpp" #include +#include #include +#include #include #include @@ -1612,15 +1614,24 @@ void map_close_logfile(void) { if (map_logfile) { - std::string filenameop_buf = STRPRINTF( - "gzip -f %s.%ld", - map_logfile_name, - map_logfile_index); + std::string filename = STRPRINTF("%s.%ld", map_logfile_name, map_logfile_index); + const char *args[] = + { + "gzip", + "-f", + filename.c_str(), + NULL + }; + char **argv = const_cast(args); fclose(map_logfile); - if (!system(filenameop_buf.c_str())) - perror(filenameop_buf.c_str()); + if (!fork()) + { + execvp("gzip", argv); + _exit(1); + } + wait(NULL); } } diff --git a/src/map/map.t.hpp b/src/map/map.t.hpp index e6417eb..09444fd 100644 --- a/src/map/map.t.hpp +++ b/src/map/map.t.hpp @@ -270,9 +270,7 @@ enum class SP : uint16_t #if 0 SPEED_RATE = 1018, #endif -#if 0 CRITICAL_DEF = 1019, -#endif #if 0 NEAR_ATK_DEF = 1020, #endif diff --git a/src/map/pc.cpp b/src/map/pc.cpp index c5fa07c..4eb49e3 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -1715,12 +1715,10 @@ int pc_bonus(struct map_session_data *sd, SP type, int val) sd->sprecov_rate += val; break; #endif -#if 0 case SP::CRITICAL_DEF: if (sd->state.lr_flag != 2) sd->critical_def += val; break; -#endif #if 0 case SP::DOUBLE_RATE: if (sd->state.lr_flag == 0 && sd->double_rate < val) -- cgit v1.2.3-60-g2f50