summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.cpp4
-rw-r--r--src/map/battle.cpp20
-rw-r--r--src/map/chrif.cpp8
-rw-r--r--src/map/clif.cpp14
-rw-r--r--src/map/magic-stmt.cpp2
-rw-r--r--src/map/map.hpp6
-rw-r--r--src/map/mob.cpp36
-rw-r--r--src/map/npc.cpp14
-rw-r--r--src/map/party.cpp2
-rw-r--r--src/map/pc.cpp46
-rw-r--r--src/map/script.cpp6
-rw-r--r--src/map/skill.cpp10
12 files changed, 84 insertions, 84 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index e6e321d..a17838f 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -1613,7 +1613,7 @@ ATCE atcommand_pvpon(Session *s, dumb_ptr<map_session_data> sd,
{
if (sd->bl_m == pl_sd->bl_m && !pl_sd->pvp_timer)
{
- pl_sd->pvp_timer = Timer(gettick() + std::chrono::milliseconds(200),
+ pl_sd->pvp_timer = Timer(gettick() + 200_ms,
std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2, pl_sd->bl_id));
pl_sd->pvp_rank = 0;
pl_sd->pvp_lastusers = 0;
@@ -4403,7 +4403,7 @@ ATCE atcommand_summon(Session *, dumb_ptr<map_session_data> sd,
md->master_id = sd->bl_id;
md->state.special_mob_ai = 1;
md->mode = get_mob_db(md->mob_class).mode | MobMode::AGGRESSIVE;
- md->deletetimer = Timer(tick + std::chrono::minutes(1),
+ md->deletetimer = Timer(tick + 1_min,
std::bind(mob_timer_delete, ph::_1, ph::_2,
id));
clif_misceffect(md, 344);
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 5219675..c0459a7 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -712,16 +712,16 @@ int battle_get_mdef2(dumb_ptr<block_list> bl)
*/
interval_t battle_get_speed(dumb_ptr<block_list> bl)
{
- nullpo_retr(std::chrono::seconds(1), bl);
+ nullpo_retr(1_s, bl);
if (bl->bl_type == BL::PC)
return bl->is_player()->speed;
else
{
- interval_t speed = std::chrono::seconds(1);
+ interval_t speed = 1_s;
if (bl->bl_type == BL::MOB)
speed = static_cast<interval_t>(bl->is_mob()->stats[mob_stat::SPEED]);
- return std::max(speed, std::chrono::milliseconds(1));
+ return std::max(speed, 1_ms);
}
}
@@ -733,13 +733,13 @@ interval_t battle_get_speed(dumb_ptr<block_list> bl)
// TODO figure out what all the doubling is about
interval_t battle_get_adelay(dumb_ptr<block_list> bl)
{
- nullpo_retr(std::chrono::seconds(4), bl);
+ nullpo_retr(4_s, bl);
if (bl->bl_type == BL::PC)
return bl->is_player()->aspd * 2;
else
{
eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data = battle_get_sc_data(bl);
- interval_t adelay = std::chrono::seconds(4);
+ interval_t adelay = 4_s;
int aspd_rate = 100;
if (bl->bl_type == BL::MOB)
adelay = static_cast<interval_t>(bl->is_mob()->stats[mob_stat::ADELAY]);
@@ -761,13 +761,13 @@ interval_t battle_get_adelay(dumb_ptr<block_list> bl)
interval_t battle_get_amotion(dumb_ptr<block_list> bl)
{
- nullpo_retr(std::chrono::seconds(2), bl);
+ nullpo_retr(2_s, bl);
if (bl->bl_type == BL::PC)
return bl->is_player()->amotion;
else
{
eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data = battle_get_sc_data(bl);
- interval_t amotion = std::chrono::seconds(2);
+ interval_t amotion = 2_s;
int aspd_rate = 100;
if (bl->bl_type == BL::MOB)
amotion = static_cast<interval_t>(get_mob_db(bl->is_mob()->mob_class).amotion);
@@ -798,7 +798,7 @@ interval_t battle_get_dmotion(dumb_ptr<block_list> bl)
return bl->is_player()->dmotion;
}
else
- return std::chrono::seconds(2);
+ return 2_s;
}
LevelElement battle_get_element(dumb_ptr<block_list> bl)
@@ -2052,7 +2052,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
&& (sd->status.weapon == ItemLook::_16
|| sd->status.weapon >= ItemLook::SINGLE_HANDED_COUNT)
&& wd.damage2 == 0)
- clif_damage(src, target, tick + std::chrono::milliseconds(10),
+ clif_damage(src, target, tick + 10_ms,
wd.amotion, wd.dmotion, 0, 1, DamageType::NORMAL, 0);
}
@@ -2580,7 +2580,7 @@ bool battle_config_read(ZString cfgName)
void battle_config_check()
{
{
- if (static_cast<interval_t>(battle_config.flooritem_lifetime) < std::chrono::seconds(1))
+ if (static_cast<interval_t>(battle_config.flooritem_lifetime) < 1_s)
battle_config.flooritem_lifetime = std::chrono::duration_cast<std::chrono::milliseconds>(LIFETIME_FLOORITEM).count();
if (battle_config.restart_hp_rate < 0)
battle_config.restart_hp_rate = 0;
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index 7c47ea7..0748f43 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -1322,13 +1322,13 @@ void check_connect_char_server(TimerData *, tick_t)
*/
void do_init_chrif(void)
{
- Timer(gettick() + std::chrono::seconds(1),
+ Timer(gettick() + 1_s,
check_connect_char_server,
- std::chrono::seconds(10)
+ 10_s
).detach();
- Timer(gettick() + std::chrono::seconds(1),
+ Timer(gettick() + 1_s,
send_users_tochar,
- std::chrono::seconds(5)
+ 5_s
).detach();
}
} // namespace tmwa
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index a8a57e6..eae922d 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -1139,7 +1139,7 @@ void clif_waitclose(TimerData *, tick_t, Session *s)
*/
void clif_setwaitclose(Session *s)
{
- s->timed_close = Timer(gettick() + std::chrono::seconds(5),
+ s->timed_close = Timer(gettick() + 5_s,
std::bind(clif_waitclose, ph::_1, ph::_2,
s)
);
@@ -3457,7 +3457,7 @@ RecvResult clif_parse_LoadEndAck(Session *s, dumb_ptr<map_session_data> sd)
if (!battle_config.pk_mode)
{
// remove pvp stuff for pk_mode [Valaris]
- sd->pvp_timer = Timer(gettick() + std::chrono::milliseconds(200),
+ sd->pvp_timer = Timer(gettick() + 200_ms,
std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2,
sd->bl_id));
sd->pvp_rank = 0;
@@ -3587,7 +3587,7 @@ void clif_do_quit_game(Session *s, dumb_ptr<map_session_data> sd)
/* Rovert's prevent logout option fixed [Valaris] */
if (!battle_config.prevent_logout
- || tick >= sd->canlog_tick + std::chrono::seconds(10))
+ || tick >= sd->canlog_tick + 10_s)
{
clif_setwaitclose(s);
fixed_18b.okay = 0;
@@ -3966,7 +3966,7 @@ RecvResult clif_parse_Restart(Session *s, dumb_ptr<map_session_data> sd)
case 0x01:
/* Rovert's Prevent logout option - Fixed [Valaris] */
if (!battle_config.prevent_logout
- || gettick() >= sd->canlog_tick + std::chrono::seconds(10))
+ || gettick() >= sd->canlog_tick + 10_s)
{
chrif_charselectreq(sd);
}
@@ -5398,7 +5398,7 @@ uint16_t clif_check_packet_flood(Session *s, int cmd)
// Default rate is 100ms
interval_t rate = clif_parse_func_table[cmd].rate;
if (rate == interval_t::zero())
- rate = std::chrono::milliseconds(100);
+ rate = 100_ms;
// ActionRequest - attacks are allowed a faster rate than sit/stand
if (cmd == 0x89)
@@ -5413,9 +5413,9 @@ uint16_t clif_check_packet_flood(Session *s, int cmd)
return 0;
}
if (damage_type == DamageType::NORMAL || damage_type == DamageType::CONTINUOUS)
- rate = std::chrono::milliseconds(20);
+ rate = 20_ms;
else
- rate = std::chrono::seconds(1);
+ rate = 1_s;
}
// Restore this code when mana1.0 is released
diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp
index 57fbe66..cbd97a8 100644
--- a/src/map/magic-stmt.cpp
+++ b/src/map/magic-stmt.cpp
@@ -305,7 +305,7 @@ dumb_ptr<npc_data> local_spell_effect(map_local *m, int x, int y, int effect,
interval_t tdelay)
{
/* 1 minute should be enough for all interesting spell effects, I hope */
- std::chrono::seconds delay = std::chrono::seconds(30);
+ std::chrono::seconds delay = 30_s;
dumb_ptr<npc_data> effect_npc = npc_spawn_text(m, x, y,
INVISIBLE_NPC, NpcName(), "?"_s);
BlockId effect_npc_id = effect_npc->bl_id;
diff --git a/src/map/map.hpp b/src/map/map.hpp
index e9a37b6..0e4815c 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -57,16 +57,16 @@ namespace tmwa
constexpr int MAX_NPC_PER_MAP = 512;
constexpr int BLOCK_SIZE = 8;
#define AREA_SIZE battle_config.area_size
-constexpr std::chrono::seconds LIFETIME_FLOORITEM = std::chrono::minutes(1);
+constexpr std::chrono::seconds LIFETIME_FLOORITEM = 1_min;
constexpr int MAX_SKILL_LEVEL = 100;
constexpr int MAX_EVENTTIMER = 32;
-constexpr interval_t NATURAL_HEAL_INTERVAL = std::chrono::milliseconds(500);
+constexpr interval_t NATURAL_HEAL_INTERVAL = 500_ms;
constexpr BlockId MAX_FLOORITEM = wrap<BlockId>(500000_u32);
constexpr int MAX_LEVEL = 255;
constexpr int MAX_WALKPATH = 48;
constexpr int MAX_DROP_PER_MAP = 48;
-constexpr interval_t DEFAULT_AUTOSAVE_INTERVAL = std::chrono::minutes(1);
+constexpr interval_t DEFAULT_AUTOSAVE_INTERVAL = 1_min;
// formerly VString<49>, as name::label
struct NpcEvent
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index f9edda9..fad3083 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -59,7 +59,7 @@
namespace tmwa
{
-constexpr interval_t MIN_MOBTHINKTIME = std::chrono::milliseconds(100);
+constexpr interval_t MIN_MOBTHINKTIME = 100_ms;
// Move probability in the negligent mode MOB (rate of 1000 minute)
constexpr random_::Fraction MOB_LAZYMOVEPERC {50, 1000};
@@ -672,7 +672,7 @@ int mob_walk(dumb_ptr<mob_data> md, tick_t tick, unsigned char data)
{
i = i / 2;
if (md->walkpath.path_half == 0)
- i = std::max(i, std::chrono::milliseconds(1));
+ i = std::max(i, 1_ms);
md->timer = Timer(tick + i,
std::bind(mob_timer, ph::_1, ph::_2,
md->bl_id, md->walkpath.path_pos));
@@ -879,7 +879,7 @@ int mob_changestate(dumb_ptr<mob_data> md, MS state, bool type)
{
tick_t tick = gettick();
interval_t i = md->attackabletime - tick;
- if (i > interval_t::zero() && i < std::chrono::seconds(2))
+ if (i > interval_t::zero() && i < 2_s)
md->timer = Timer(md->attackabletime,
std::bind(mob_timer, ph::_1, ph::_2,
md->bl_id, 0));
@@ -892,7 +892,7 @@ int mob_changestate(dumb_ptr<mob_data> md, MS state, bool type)
}
else
{
- md->attackabletime = tick + std::chrono::milliseconds(1);
+ md->attackabletime = tick + 1_ms;
md->timer = Timer(md->attackabletime,
std::bind(mob_timer, ph::_1, ph::_2,
md->bl_id, 0));
@@ -1058,7 +1058,7 @@ int mob_setdelayspawn(BlockId id)
tick_t spawntime1 = md->last_spawntime + md->spawn.delay1;
tick_t spawntime2 = md->last_deadtime + md->spawn.delay2;
- tick_t spawntime3 = gettick() + std::chrono::seconds(5);
+ tick_t spawntime3 = gettick() + 5_s;
tick_t spawntime = std::max({spawntime1, spawntime2, spawntime3});
Timer(spawntime,
@@ -1121,7 +1121,7 @@ int mob_spawn(BlockId id)
if (i >= 50)
{
- Timer(tick + std::chrono::seconds(5),
+ Timer(tick + 5_s,
std::bind(mob_delayspawn, ph::_1, ph::_2,
id)
).detach();
@@ -1151,7 +1151,7 @@ int mob_spawn(BlockId id)
md->state.skillstate = MobSkillState::MSS_IDLE;
assert (!md->timer);
md->last_thinktime = tick;
- md->next_walktime = tick + std::chrono::seconds(5) + std::chrono::milliseconds(random_::to(50));
+ md->next_walktime = tick + 5_s + std::chrono::milliseconds(random_::to(50));
md->attackabletime = tick;
md->canmove_tick = tick;
@@ -1160,7 +1160,7 @@ int mob_spawn(BlockId id)
// md->skilltimer = nullptr;
md->skilldelayup = make_unique<tick_t[]>(get_mob_db(md->mob_class).skills.size());
for (size_t i = 0; i < get_mob_db(md->mob_class).skills.size(); i++)
- md->skilldelayup[i] = tick - std::chrono::hours(10);
+ md->skilldelayup[i] = tick - 10_h;
md->skillid = SkillID();
md->skilllv = 0;
@@ -1640,7 +1640,7 @@ int mob_ai_sub_hard_slavemob(dumb_ptr<mob_data> md, tick_t tick)
while (ret && i < 10);
}
- md->next_walktime = tick + std::chrono::milliseconds(500);
+ md->next_walktime = tick + 500_ms;
md->state.master_check = 1;
}
@@ -1684,7 +1684,7 @@ int mob_unlocktarget(dumb_ptr<mob_data> md, tick_t tick)
md->target_id = BlockId();
md->state.attackable = false;
md->state.skillstate = MobSkillState::MSS_IDLE;
- md->next_walktime = tick + std::chrono::seconds(3) + std::chrono::milliseconds(random_::to(3000));
+ md->next_walktime = tick + 3_s + std::chrono::milliseconds(random_::to(3000));
return 0;
}
@@ -1738,7 +1738,7 @@ int mob_randomwalk(dumb_ptr<mob_data> md, tick_t tick)
else
c += speed;
}
- md->next_walktime = tick + std::chrono::seconds(3) + std::chrono::milliseconds(random_::to(3000)) + c;
+ md->next_walktime = tick + 3_s + std::chrono::milliseconds(random_::to(3000)) + c;
md->state.skillstate = MobSkillState::MSS_WALK;
return 1;
}
@@ -1919,7 +1919,7 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick)
else
{
// 追跡
- md->next_walktime = tick + std::chrono::milliseconds(500);
+ md->next_walktime = tick + 500_ms;
i = 0;
do
{
@@ -2003,7 +2003,7 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick)
&& (md->next_walktime < tick
|| distance(md->to_x, md->to_y, tbl->bl_x, tbl->bl_y) <= 0))
return; // 既に移動中
- md->next_walktime = tick + std::chrono::milliseconds(500);
+ md->next_walktime = tick + 500_ms;
dx = tbl->bl_x - md->bl_x;
dy = tbl->bl_y - md->bl_y;
ret = mob_walktoxy(md, md->bl_x + dx, md->bl_y + dy, 0);
@@ -2045,11 +2045,11 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick)
{
// if walktime is more than 7 seconds in the future,
// set it to somewhere between 3 and 5 seconds
- if (md->next_walktime > tick + std::chrono::seconds(7)
+ if (md->next_walktime > tick + 7_s
&& (md->walkpath.path_len == 0
|| md->walkpath.path_pos >= md->walkpath.path_len))
{
- md->next_walktime = tick + std::chrono::seconds(3)
+ md->next_walktime = tick + 3_s
+ std::chrono::milliseconds(random_::to(2000));
}
@@ -2148,7 +2148,7 @@ void mob_ai_sub_lazy(dumb_ptr<block_list> bl, tick_t tick)
mob_warp(md, nullptr, -1, -1, BeingRemoveWhy::NEGATIVE1);
}
- md->next_walktime = tick + std::chrono::seconds(5) + std::chrono::milliseconds(random_::to(10 * 1000));
+ md->next_walktime = tick + 5_s + std::chrono::milliseconds(random_::to(10 * 1000));
}
}
@@ -2640,7 +2640,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage,
ditem.first_sd = mvp_sd;
ditem.second_sd = second_sd;
ditem.third_sd = third_sd;
- Timer(tick + std::chrono::milliseconds(500) + static_cast<interval_t>(i),
+ Timer(tick + 500_ms + static_cast<interval_t>(i),
std::bind(mob_delay_item_drop, ph::_1, ph::_2,
ditem)
).detach();
@@ -2658,7 +2658,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage,
ditem.second_sd = second_sd;
ditem.third_sd = third_sd;
// ?
- Timer(tick + std::chrono::milliseconds(540) + static_cast<interval_t>(i),
+ Timer(tick + 540_ms + static_cast<interval_t>(i),
std::bind(mob_delay_item_drop2, ph::_1, ph::_2,
ditem)
).detach();
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index 16090b2..a6427d6 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -181,7 +181,7 @@ int npc_event_dequeue(dumb_ptr<map_session_data> sd)
if (!sd->eventqueuel.empty())
{
- if (!pc_addeventtimer(sd, std::chrono::milliseconds(100), sd->eventqueuel.front()))
+ if (!pc_addeventtimer(sd, 100_ms, sd->eventqueuel.front()))
{
PRINTF("npc_event_dequeue(): Event timer is full.\n"_fmt);
return 0;
@@ -318,9 +318,9 @@ int npc_event_do_oninit(void)
int c = npc_event_doall(stringish<ScriptLabel>("OnInit"_s));
PRINTF("npc: OnInit Event done. (%d npc)\n"_fmt, c);
- Timer(gettick() + std::chrono::milliseconds(100),
+ Timer(gettick() + 100_ms,
npc_event_do_clock,
- std::chrono::seconds(1)
+ 1_s
).detach();
return 0;
@@ -1042,7 +1042,7 @@ int npc_parse_warp(XString w1, XString, NpcName w3, XString w4)
nd->npc_class = WARP_CLASS;
else
nd->npc_class = WARP_DEBUG_CLASS;
- nd->speed = std::chrono::milliseconds(200);
+ nd->speed = 200_ms;
nd->option = Option::ZERO;
nd->opt1 = Opt1::ZERO;
nd->opt2 = Opt2::ZERO;
@@ -1157,7 +1157,7 @@ int npc_parse_shop(XString w1, XString, NpcName w3, ZString w4a)
nd->flag = 0;
nd->name = w3;
nd->npc_class = npc_class;
- nd->speed = std::chrono::milliseconds(200);
+ nd->speed = 200_ms;
nd->option = Option::ZERO;
nd->opt1 = Opt1::ZERO;
nd->opt2 = Opt2::ZERO;
@@ -1338,7 +1338,7 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4,
nd->dir = dir;
nd->flag = 0;
nd->npc_class = npc_class;
- nd->speed = std::chrono::milliseconds(200);
+ nd->speed = 200_ms;
nd->scr.script = std::move(script);
nd->option = Option::ZERO;
nd->opt1 = Opt1::ZERO;
@@ -1620,7 +1620,7 @@ dumb_ptr<npc_data> npc_spawn_text(map_local *m, int x, int y,
retval->message = message;
retval->npc_class = npc_class;
- retval->speed = std::chrono::milliseconds(200);
+ retval->speed = 200_ms;
clif_spawnnpc(retval);
map_addblock(retval);
diff --git a/src/map/party.cpp b/src/map/party.cpp
index 7784a02..8713c60 100644
--- a/src/map/party.cpp
+++ b/src/map/party.cpp
@@ -46,7 +46,7 @@
namespace tmwa
{
// 座標やHP送信の間隔
-constexpr interval_t PARTY_SEND_XYHP_INVERVAL = std::chrono::seconds(1);
+constexpr interval_t PARTY_SEND_XYHP_INVERVAL = 1_s;
static
Map<PartyId, PartyMost> party_db;
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 3b3a6b3..fbc64a7 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -68,7 +68,7 @@ namespace tmwa
{
// PVP順位計算の間隔
constexpr std::chrono::milliseconds PVP_CALCRANK_INTERVAL =
- std::chrono::seconds(1);
+ 1_s;
//define it here, since the ifdef only occurs in this file
#define USE_ASTRAL_SOUL_SKILL
@@ -121,23 +121,23 @@ int sp_coefficient_0 = 100;
static //const
earray<interval_t, ItemLook, ItemLook::SINGLE_HANDED_COUNT> aspd_base_0 //=
{{
-std::chrono::milliseconds(650),
-std::chrono::milliseconds(700),
-std::chrono::milliseconds(750),
-std::chrono::milliseconds(600),
-std::chrono::milliseconds(2000),
-std::chrono::milliseconds(2000),
-std::chrono::milliseconds(800),
-std::chrono::milliseconds(2000),
-std::chrono::milliseconds(700),
-std::chrono::milliseconds(700),
-std::chrono::milliseconds(650),
-std::chrono::milliseconds(900),
-std::chrono::milliseconds(2000),
-std::chrono::milliseconds(2000),
-std::chrono::milliseconds(2000),
-std::chrono::milliseconds(2000),
-std::chrono::milliseconds(2000),
+650_ms,
+700_ms,
+750_ms,
+600_ms,
+2000_ms,
+2000_ms,
+800_ms,
+2000_ms,
+700_ms,
+700_ms,
+650_ms,
+900_ms,
+2000_ms,
+2000_ms,
+2000_ms,
+2000_ms,
+2000_ms,
}};
static const
int exp_table_0[MAX_LEVEL] =
@@ -1393,7 +1393,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
if (sd->speed_rate != 100)
sd->speed = sd->speed * sd->speed_rate / 100;
- sd->speed = std::max(sd->speed, std::chrono::milliseconds(1));
+ sd->speed = std::max(sd->speed, 1_ms);
if (aspd_rate != 100)
sd->aspd = sd->aspd * aspd_rate / 100;
@@ -1403,7 +1403,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
sd->aspd = std::max(sd->aspd, static_cast<interval_t>(battle_config.max_aspd));
sd->amotion = sd->aspd;
sd->dmotion = std::chrono::milliseconds(800 - sd->paramc[ATTR::AGI] * 4);
- sd->dmotion = std::max(sd->dmotion, std::chrono::milliseconds(400));
+ sd->dmotion = std::max(sd->dmotion, 400_ms);
if (sd->status.hp > sd->status.max_hp)
sd->status.hp = sd->status.max_hp;
@@ -2528,7 +2528,7 @@ void pc_walk(TimerData *, tick_t tick, BlockId id, unsigned char data)
{
i = i / 2;
if (sd->walkpath.path_half == 0)
- i = std::max(i, std::chrono::milliseconds(1));
+ i = std::max(i, 1_ms);
sd->walktimer = Timer(tick + i,
std::bind(pc_walk, ph::_1, ph::_2,
@@ -2864,7 +2864,7 @@ int pc_attack(dumb_ptr<map_session_data> sd, BlockId target_id, int type)
sd->state.attack_continue = type;
interval_t d = sd->attackabletime - gettick();
- if (d > interval_t::zero() && d < std::chrono::seconds(2))
+ if (d > interval_t::zero() && d < 2_s)
{ // 攻撃delay中
sd->attacktimer = Timer(sd->attackabletime,
std::bind(pc_attack_timer, ph::_1, ph::_2,
@@ -5173,7 +5173,7 @@ void pc_autosave(TimerData *, tick_t)
interval_t interval = autosave_time / (clif_countusers() + 1);
if (interval <= interval_t::zero())
- interval = std::chrono::milliseconds(1);
+ interval = 1_ms;
Timer(gettick() + interval,
pc_autosave
).detach();
diff --git a/src/map/script.cpp b/src/map/script.cpp
index adc7789..37861e5 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -99,7 +99,7 @@ Map<SIR, RString> mapregstr_db;
static
int mapreg_dirty = -1;
AString mapreg_txt = "save/mapreg.txt"_s;
-constexpr std::chrono::milliseconds MAPREG_AUTOSAVE_INTERVAL = std::chrono::seconds(10);
+constexpr std::chrono::milliseconds MAPREG_AUTOSAVE_INTERVAL = 10_s;
Map<ScriptLabel, int> scriptlabel_db;
static
@@ -3131,7 +3131,7 @@ void builtin_sc_start(ScriptState *st)
int val1;
StatusChange type = static_cast<StatusChange>(conv_num(st, &AARGO2(2)));
interval_t tick = static_cast<interval_t>(conv_num(st, &AARGO2(3)));
- if (tick < std::chrono::seconds(1))
+ if (tick < 1_s)
// work around old behaviour of:
// speed potion
// atk potion
@@ -3307,7 +3307,7 @@ void builtin_pvpon(ScriptState *st)
{
if (m == pl_sd->bl_m && !pl_sd->pvp_timer)
{
- pl_sd->pvp_timer = Timer(gettick() + std::chrono::milliseconds(200),
+ pl_sd->pvp_timer = Timer(gettick() + 200_ms,
std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2,
pl_sd->bl_id));
pl_sd->pvp_rank = 0;
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index 5b5ca63..f579920 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -883,7 +883,7 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, BlockId id, StatusCh
md->hp -= hp;
}
}
- sc_data[type].timer = Timer(tick + std::chrono::seconds(1),
+ sc_data[type].timer = Timer(tick + 1_s,
std::bind(skill_status_change_timer, ph::_1, ph::_2,
bl->bl_id, type));
return;
@@ -891,7 +891,7 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, BlockId id, StatusCh
}
else
{
- sc_data[type].timer = Timer(tick + std::chrono::seconds(2),
+ sc_data[type].timer = Timer(tick + 2_s,
std::bind(skill_status_change_timer, ph::_1, ph::_2,
bl->bl_id, type));
return;
@@ -903,7 +903,7 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, BlockId id, StatusCh
/* 時間切れ無し?? */
case StatusChange::SC_WEIGHT50:
case StatusChange::SC_WEIGHT90:
- sc_data[type].timer = Timer(tick + std::chrono::minutes(10),
+ sc_data[type].timer = Timer(tick + 10_min,
std::bind(skill_status_change_timer, ph::_1, ph::_2,
bl->bl_id, type));
return;
@@ -1029,12 +1029,12 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type,
}
// huh?
- tick = std::chrono::seconds(1);
+ tick = 1_s;
break;
case StatusChange::SC_WEIGHT50:
case StatusChange::SC_WEIGHT90:
- tick = std::chrono::minutes(10);
+ tick = 10_min;
break;
case StatusChange::SC_HASTE: