From 80e36aa669274637bcd5956fbf4020dba1d4739c Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 9 Feb 2013 01:51:36 -0800 Subject: Strictify timers --- src/char/char.cpp | 55 +- src/char/char.hpp | 4 - src/char/inter.cpp | 10 +- src/common/core.cpp | 6 +- src/common/mmo.hpp | 8 +- src/common/nullpo.hpp | 2 +- src/common/socket.cpp | 10 +- src/common/socket.hpp | 4 +- src/common/timer.cpp | 288 ++---- src/common/timer.hpp | 78 +- src/common/timer.t.hpp | 28 + src/login/login.cpp | 80 +- src/map/atcommand.cpp | 222 +---- src/map/battle.cpp | 343 +++---- src/map/battle.hpp | 20 +- src/map/chrif.cpp | 14 +- src/map/clif.cpp | 1752 +++++++++++++++++------------------- src/map/clif.hpp | 11 +- src/map/magic-expr.cpp | 2 +- src/map/magic-interpreter-base.cpp | 25 +- src/map/magic-interpreter.hpp | 2 +- src/map/magic-stmt.cpp | 116 +-- src/map/map.cpp | 147 +-- src/map/map.hpp | 110 ++- src/map/map.t.hpp | 1 - src/map/mob.cpp | 443 +++++---- src/map/mob.hpp | 14 +- src/map/npc.cpp | 172 +--- src/map/npc.hpp | 7 +- src/map/party.cpp | 10 +- src/map/path.cpp | 3 +- src/map/pc.cpp | 748 +++++---------- src/map/pc.hpp | 17 +- src/map/script.cpp | 67 +- src/map/skill.cpp | 479 ++-------- src/map/skill.hpp | 22 +- src/map/skill.t.hpp | 67 -- 37 files changed, 2005 insertions(+), 3382 deletions(-) create mode 100644 src/common/timer.t.hpp (limited to 'src') diff --git a/src/char/char.cpp b/src/char/char.cpp index 775ac69..7954655 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -37,7 +37,11 @@ int server_freezeflag[MAX_MAP_SERVERS]; // Map-server anti-freeze system. Cou static int anti_freeze_enable = 0; static -int ANTI_FREEZE_INTERVAL = 6; +std::chrono::seconds ANTI_FREEZE_INTERVAL = std::chrono::seconds(6); + +constexpr +std::chrono::milliseconds DEFAULT_AUTOSAVE_INTERVAL = + std::chrono::minutes(5); // TODO replace all string forms of IP addresses with class instances static @@ -120,7 +124,8 @@ static int char_num, char_max; static int max_connect_user = 0; -int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL; +static +std::chrono::milliseconds autosave_interval = DEFAULT_AUTOSAVE_INTERVAL; static int start_zeny = 500; static @@ -569,7 +574,7 @@ void mmo_char_sync(void) // Function to save (in a periodic way) datas in files //---------------------------------------------------- static -void mmo_char_sync_timer(timer_id, tick_t, custom_id_t, custom_data_t) +void mmo_char_sync_timer(TimerData *, tick_t) { if (pid != 0) { @@ -784,7 +789,7 @@ int make_new_char(int fd, const uint8_t *dat) char_dat[i].sp = char_dat[i].max_sp; char_dat[i].status_point = 0; char_dat[i].skill_point = 0; - char_dat[i].option = Option(0x0000); + char_dat[i].option = static_cast