summaryrefslogtreecommitdiff
path: root/src/map/script.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-04-17 13:22:58 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-04-27 14:09:22 -0700
commitd18f5bdb682a1d9c6e3a191926bfd46d36e813c1 (patch)
treec987d53ea924b761e5445572a438e0c4bc825d48 /src/map/script.cpp
parentda6b990ca1f553a017003f32a436304c66c62b9e (diff)
downloadtmwa-d18f5bdb682a1d9c6e3a191926bfd46d36e813c1.tar.gz
tmwa-d18f5bdb682a1d9c6e3a191926bfd46d36e813c1.tar.bz2
tmwa-d18f5bdb682a1d9c6e3a191926bfd46d36e813c1.tar.xz
tmwa-d18f5bdb682a1d9c6e3a191926bfd46d36e813c1.zip
Force timers to be managed
Diffstat (limited to 'src/map/script.cpp')
-rw-r--r--src/map/script.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 151175b..55c7d42 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -3570,7 +3570,7 @@ void builtin_pvpon(ScriptState *st)
{
if (m == pl_sd->bl.m && !pl_sd->pvp_timer)
{
- pl_sd->pvp_timer = add_timer(gettick() + std::chrono::milliseconds(200),
+ pl_sd->pvp_timer = Timer(gettick() + std::chrono::milliseconds(200),
std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2,
pl_sd->bl.id));
pl_sd->pvp_rank = 0;
@@ -3605,11 +3605,7 @@ void builtin_pvpoff(ScriptState *st)
{
if (m == pl_sd->bl.m)
{
- if (pl_sd->pvp_timer)
- {
- delete_timer(pl_sd->pvp_timer);
- pl_sd->pvp_timer = nullptr;
- }
+ pl_sd->pvp_timer.cancel();
}
}
}
@@ -5109,9 +5105,10 @@ void do_init_script(void)
{
script_load_mapreg();
- add_timer_interval(gettick() + MAPREG_AUTOSAVE_INTERVAL,
+ Timer(gettick() + MAPREG_AUTOSAVE_INTERVAL,
script_autosave_mapreg,
- MAPREG_AUTOSAVE_INTERVAL);
+ MAPREG_AUTOSAVE_INTERVAL
+ ).detach();
}
#define BUILTIN(func, args) \