diff options
author | gumi <git@gumi.ca> | 2019-04-15 12:28:49 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2019-04-15 12:28:49 -0400 |
commit | ec0e6921392ad1ec8a3086413d01591d049217f1 (patch) | |
tree | 9c8dee45bf4b57fa90dd67b42b98437a405a810f | |
parent | 1886d63ef5986a3e613b4880dc7ae00636435e0a (diff) | |
download | tmwa-ec0e6921392ad1ec8a3086413d01591d049217f1.tar.gz tmwa-ec0e6921392ad1ec8a3086413d01591d049217f1.tar.bz2 tmwa-ec0e6921392ad1ec8a3086413d01591d049217f1.tar.xz tmwa-ec0e6921392ad1ec8a3086413d01591d049217f1.zip |
add a built-in gm log delay option
-rw-r--r-- | src/map/atcommand.cpp | 17 | ||||
-rwxr-xr-x | tools/config.py | 2 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index a21848b..f19b6c9 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -208,19 +208,24 @@ bool asplit(ZString raw, F *first_arg, R *... rest_args) static io::AppendFile *get_gm_log(); -void log_atcommand(dumb_ptr<map_session_data> sd, ZString cmd) +static +void real_log_atcommand(TimerData *, tick_t, AString cmd) { io::AppendFile *fp = get_gm_log(); if (!fp) return; + FPRINTF(*fp, "%s\n"_fmt, cmd); +} + +void log_atcommand(dumb_ptr<map_session_data> sd, ZString cmd) +{ timestamp_seconds_buffer tmpstr; stamp_time(tmpstr); MapName map = (sd->bl_m->name_); - FPRINTF(*fp, "[%s] %s(%d,%d) %s(%d) : %s\n"_fmt, - tmpstr, - map, sd->bl_x, sd->bl_y, - sd->status_key.name, sd->status_key.account_id, - cmd); + AString str = STRPRINTF("[%s] %s(%d,%d) %s(%d) : %s"_fmt, tmpstr, + map, sd->bl_x, sd->bl_y, sd->status_key.name, + sd->status_key.account_id, cmd); + Timer(gettick() + battle_config.gm_log_delay, std::bind(real_log_atcommand, ph::_1, ph::_2, str)).detach(); } io::AppendFile *get_gm_log() diff --git a/tools/config.py b/tools/config.py index f029777..a187c06 100755 --- a/tools/config.py +++ b/tools/config.py @@ -680,6 +680,8 @@ def build_config(): battle_conf.opt('itemheal_regeneration_factor', i32, '1') battle_conf.opt('mob_splash_radius', i32, '-1', min='-1') + battle_conf.opt('gm_log_delay', milliseconds, '60_min') + return rv def main(): |