summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/atcommand.cpp17
-rwxr-xr-xtools/config.py2
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():