summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-10-12 18:41:40 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-10-12 18:41:40 -0700
commitedd67db458188a76934b963e6a40f7b681f86b3d (patch)
treec8dec729b3f539ba027b1b3559598dbad0a70546
parent524df2190b855c4096449a1aaa7b92a15875f7a7 (diff)
downloadtmwa-edd67db458188a76934b963e6a40f7b681f86b3d.tar.gz
tmwa-edd67db458188a76934b963e6a40f7b681f86b3d.tar.bz2
tmwa-edd67db458188a76934b963e6a40f7b681f86b3d.tar.xz
tmwa-edd67db458188a76934b963e6a40f7b681f86b3d.zip
Disallow unchecked being casts
Despite the fact that that's what the code always did, it was sometimes wrong.
-rw-r--r--src/map/atcommand.cpp8
-rw-r--r--src/map/battle.cpp214
-rw-r--r--src/map/chrif.cpp6
-rw-r--r--src/map/clif.cpp50
-rw-r--r--src/map/magic-expr-eval.hpp6
-rw-r--r--src/map/magic-expr.cpp20
-rw-r--r--src/map/magic-interpreter-base.cpp2
-rw-r--r--src/map/magic-stmt.cpp68
-rw-r--r--src/map/map.cpp12
-rw-r--r--src/map/map.hpp39
-rw-r--r--src/map/mob.cpp60
-rw-r--r--src/map/npc.cpp48
-rw-r--r--src/map/party.cpp2
-rw-r--r--src/map/pc.cpp12
-rw-r--r--src/map/script.cpp38
-rw-r--r--src/map/skill-pools.cpp2
-rw-r--r--src/map/skill.cpp52
17 files changed, 306 insertions, 333 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index e4d1745..508209c 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -553,7 +553,7 @@ void atkillmonster_sub(dumb_ptr<block_list> bl, int flag)
{
nullpo_retv(bl);
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
if (flag)
mob_damage(NULL, md, md->hp, 2);
else
@@ -2184,7 +2184,7 @@ void atlist_nearby_sub(dumb_ptr<block_list> bl, int fd)
nullpo_retv(bl);
FString buf = STRPRINTF(" - \"%s\"",
- bl->as_player()->status.name);
+ bl->is_player()->status.name);
clif_displaymessage(fd, buf);
}
@@ -5456,7 +5456,7 @@ int atcommand_summon(const int, dumb_ptr<map_session_data> sd,
y = sd->bl_y + random_::in(-5, 4);
id = mob_once_spawn(sd, MOB_THIS_MAP, x, y, JAPANESE_NAME, mob_id, 1, NpcEvent());
- dumb_ptr<mob_data> md = map_id_as_mob(id);
+ dumb_ptr<mob_data> md = map_id_is_mob(id);
if (md)
{
md->master_id = sd->bl_id;
@@ -5725,7 +5725,7 @@ int atcommand_jump_iterate(const int fd, dumb_ptr<map_session_data> sd,
{
dumb_ptr<map_session_data> pl_sd;
- pl_sd = map_id_as_player(sd->followtarget);
+ pl_sd = map_id_is_player(sd->followtarget);
if (pl_sd)
pl_sd = get_next(pl_sd);
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 7bdac86..c95ad61 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -35,10 +35,10 @@ int battle_counttargeted(dumb_ptr<block_list> bl, dumb_ptr<block_list> src,
{
nullpo_ret(bl);
if (bl->bl_type == BL::PC)
- return pc_counttargeted(bl->as_player(), src,
+ return pc_counttargeted(bl->is_player(), src,
target_lv);
else if (bl->bl_type == BL::MOB)
- return mob_counttargeted(bl->as_mob(), src, target_lv);
+ return mob_counttargeted(bl->is_mob(), src, target_lv);
return 0;
}
@@ -51,7 +51,7 @@ int battle_get_class(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::MOB)
- return bl->as_mob()->mob_class;
+ return bl->is_mob()->mob_class;
else if (bl->bl_type == BL::PC)
return 0;
else
@@ -67,9 +67,9 @@ DIR battle_get_dir(dumb_ptr<block_list> bl)
{
nullpo_retr(DIR::S, bl);
if (bl->bl_type == BL::MOB)
- return bl->as_mob()->dir;
+ return bl->is_mob()->dir;
else if (bl->bl_type == BL::PC)
- return bl->as_player()->dir;
+ return bl->is_player()->dir;
else
return DIR::S;
}
@@ -83,9 +83,9 @@ int battle_get_lv(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::MOB)
- return bl->as_mob()->stats[mob_stat::LV];
+ return bl->is_mob()->stats[mob_stat::LV];
else if (bl->bl_type == BL::PC)
- return bl->as_player()->status.base_level;
+ return bl->is_player()->status.base_level;
else
return 0;
}
@@ -99,9 +99,9 @@ int battle_get_range(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::MOB)
- return mob_db[bl->as_mob()->mob_class].range;
+ return mob_db[bl->is_mob()->mob_class].range;
else if (bl->bl_type == BL::PC)
- return bl->as_player()->attackrange;
+ return bl->is_player()->attackrange;
else
return 0;
}
@@ -115,9 +115,9 @@ int battle_get_hp(dumb_ptr<block_list> bl)
{
nullpo_retr(1, bl);
if (bl->bl_type == BL::MOB)
- return bl->as_mob()->hp;
+ return bl->is_mob()->hp;
else if (bl->bl_type == BL::PC)
- return bl->as_player()->status.hp;
+ return bl->is_player()->status.hp;
else
return 1;
}
@@ -131,13 +131,13 @@ int battle_get_max_hp(dumb_ptr<block_list> bl)
{
nullpo_retr(1, bl);
if (bl->bl_type == BL::PC)
- return bl->as_player()->status.max_hp;
+ return bl->is_player()->status.max_hp;
else
{
int max_hp = 1;
if (bl->bl_type == BL::MOB)
{
- max_hp = bl->as_mob()->stats[mob_stat::MAX_HP];
+ max_hp = bl->is_mob()->stats[mob_stat::MAX_HP];
{
if (battle_config.monster_hp_rate != 100)
max_hp = (max_hp * battle_config.monster_hp_rate) / 100;
@@ -162,9 +162,9 @@ int battle_get_str(dumb_ptr<block_list> bl)
nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::MOB)
- str = bl->as_mob()->stats[mob_stat::STR];
+ str = bl->is_mob()->stats[mob_stat::STR];
else if (bl->bl_type == BL::PC)
- return bl->as_player()->paramc[ATTR::STR];
+ return bl->is_player()->paramc[ATTR::STR];
if (str < 0)
str = 0;
@@ -185,9 +185,9 @@ int battle_get_agi(dumb_ptr<block_list> bl)
nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::MOB)
- agi = bl->as_mob()->stats[mob_stat::AGI];
+ agi = bl->is_mob()->stats[mob_stat::AGI];
else if (bl->bl_type == BL::PC)
- agi = bl->as_player()->paramc[ATTR::AGI];
+ agi = bl->is_player()->paramc[ATTR::AGI];
if (agi < 0)
agi = 0;
@@ -207,9 +207,9 @@ int battle_get_vit(dumb_ptr<block_list> bl)
nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::MOB)
- vit = bl->as_mob()->stats[mob_stat::VIT];
+ vit = bl->is_mob()->stats[mob_stat::VIT];
else if (bl->bl_type == BL::PC)
- vit = bl->as_player()->paramc[ATTR::VIT];
+ vit = bl->is_player()->paramc[ATTR::VIT];
if (vit < 0)
vit = 0;
@@ -229,9 +229,9 @@ int battle_get_int(dumb_ptr<block_list> bl)
nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::MOB)
- int_ = bl->as_mob()->stats[mob_stat::INT];
+ int_ = bl->is_mob()->stats[mob_stat::INT];
else if (bl->bl_type == BL::PC)
- int_ = bl->as_player()->paramc[ATTR::INT];
+ int_ = bl->is_player()->paramc[ATTR::INT];
if (int_ < 0)
int_ = 0;
@@ -251,9 +251,9 @@ int battle_get_dex(dumb_ptr<block_list> bl)
nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::MOB)
- dex = bl->as_mob()->stats[mob_stat::DEX];
+ dex = bl->is_mob()->stats[mob_stat::DEX];
else if (bl->bl_type == BL::PC)
- dex = bl->as_player()->paramc[ATTR::DEX];
+ dex = bl->is_player()->paramc[ATTR::DEX];
if (dex < 0)
dex = 0;
@@ -273,9 +273,9 @@ int battle_get_luk(dumb_ptr<block_list> bl)
nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::MOB)
- luk = bl->as_mob()->stats[mob_stat::LUK];
+ luk = bl->is_mob()->stats[mob_stat::LUK];
else if (bl->bl_type == BL::PC)
- luk = bl->as_player()->paramc[ATTR::LUK];
+ luk = bl->is_player()->paramc[ATTR::LUK];
if (luk < 0)
luk = 0;
@@ -296,7 +296,7 @@ int battle_get_flee(dumb_ptr<block_list> bl)
nullpo_retr(1, bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::PC)
- flee = bl->as_player()->flee;
+ flee = bl->is_player()->flee;
else
flee = battle_get_agi(bl) + battle_get_lv(bl);
@@ -325,7 +325,7 @@ int battle_get_hit(dumb_ptr<block_list> bl)
nullpo_retr(1, bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::PC)
- hit = bl->as_player()->hit;
+ hit = bl->is_player()->hit;
else
hit = battle_get_dex(bl) + battle_get_lv(bl);
@@ -354,7 +354,7 @@ int battle_get_flee2(dumb_ptr<block_list> bl)
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
flee2 = battle_get_luk(bl) + 10;
flee2 += sd->flee2 - (sd->paramc[ATTR::LUK] + 10);
}
@@ -386,7 +386,7 @@ int battle_get_critical(dumb_ptr<block_list> bl)
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
critical = battle_get_luk(bl) * 2 + 10;
critical += sd->critical - ((sd->paramc[ATTR::LUK] * 3) + 10);
}
@@ -412,7 +412,7 @@ int battle_get_baseatk(dumb_ptr<block_list> bl)
nullpo_retr(1, bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::PC)
- batk = bl->as_player()->base_atk; //設定されているbase_atk
+ batk = bl->is_player()->base_atk; //設定されているbase_atk
else
{ //それ以外なら
int str, dstr;
@@ -439,9 +439,9 @@ int battle_get_atk(dumb_ptr<block_list> bl)
nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::PC)
- atk = bl->as_player()->watk;
+ atk = bl->is_player()->watk;
else if (bl->bl_type == BL::MOB)
- atk = bl->as_mob()->stats[mob_stat::ATK1];
+ atk = bl->is_mob()->stats[mob_stat::ATK1];
if (atk < 0)
atk = 0;
@@ -458,7 +458,7 @@ int battle_get_atk_(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::PC)
- return bl->as_player()->watk_;
+ return bl->is_player()->watk_;
else
return 0;
}
@@ -473,12 +473,12 @@ int battle_get_atk2(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::PC)
- return bl->as_player()->watk2;
+ return bl->is_player()->watk2;
else
{
int atk2 = 0;
if (bl->bl_type == BL::MOB)
- atk2 = bl->as_mob()->stats[mob_stat::ATK2];
+ atk2 = bl->is_mob()->stats[mob_stat::ATK2];
if (atk2 < 0)
atk2 = 0;
@@ -496,7 +496,7 @@ int battle_get_atk_2(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::PC)
- return bl->as_player()->watk_2;
+ return bl->is_player()->watk_2;
else
return 0;
}
@@ -520,7 +520,7 @@ int battle_get_matk1(dumb_ptr<block_list> bl)
return matk;
}
else if (bl->bl_type == BL::PC)
- return bl->as_player()->matk1;
+ return bl->is_player()->matk1;
else
return 0;
}
@@ -542,7 +542,7 @@ int battle_get_matk2(dumb_ptr<block_list> bl)
return matk;
}
else if (bl->bl_type == BL::PC)
- return bl->as_player()->matk2;
+ return bl->is_player()->matk2;
else
return 0;
}
@@ -561,11 +561,11 @@ int battle_get_def(dumb_ptr<block_list> bl)
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::PC)
{
- def = bl->as_player()->def;
+ def = bl->is_player()->def;
}
else if (bl->bl_type == BL::MOB)
{
- def = bl->as_mob()->stats[mob_stat::DEF];
+ def = bl->is_mob()->stats[mob_stat::DEF];
}
if (def < 1000000)
@@ -596,9 +596,9 @@ int battle_get_mdef(dumb_ptr<block_list> bl)
nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::PC)
- mdef = bl->as_player()->mdef;
+ mdef = bl->is_player()->mdef;
else if (bl->bl_type == BL::MOB)
- mdef = bl->as_mob()->stats[mob_stat::MDEF];
+ mdef = bl->is_mob()->stats[mob_stat::MDEF];
if (mdef < 1000000)
{
@@ -631,9 +631,9 @@ int battle_get_def2(dumb_ptr<block_list> bl)
nullpo_retr(1, bl);
sc_data = battle_get_sc_data(bl);
if (bl->bl_type == BL::PC)
- def2 = bl->as_player()->def2;
+ def2 = bl->is_player()->def2;
else if (bl->bl_type == BL::MOB)
- def2 = bl->as_mob()->stats[mob_stat::VIT];
+ def2 = bl->is_mob()->stats[mob_stat::VIT];
if (sc_data)
{
@@ -658,12 +658,12 @@ int battle_get_mdef2(dumb_ptr<block_list> bl)
nullpo_ret(bl);
if (bl->bl_type == BL::MOB)
{
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
mdef2 = md->stats[mob_stat::INT] + (md->stats[mob_stat::VIT] >> 1);
}
else if (bl->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
mdef2 = sd->mdef2 + (sd->paramc[ATTR::VIT] >> 1);
}
@@ -682,12 +682,12 @@ interval_t battle_get_speed(dumb_ptr<block_list> bl)
{
nullpo_retr(std::chrono::seconds(1), bl);
if (bl->bl_type == BL::PC)
- return bl->as_player()->speed;
+ return bl->is_player()->speed;
else
{
interval_t speed = std::chrono::seconds(1);
if (bl->bl_type == BL::MOB)
- speed = static_cast<interval_t>(bl->as_mob()->stats[mob_stat::SPEED]);
+ speed = static_cast<interval_t>(bl->is_mob()->stats[mob_stat::SPEED]);
return std::max(speed, std::chrono::milliseconds(1));
}
@@ -703,14 +703,14 @@ interval_t battle_get_adelay(dumb_ptr<block_list> bl)
{
nullpo_retr(std::chrono::seconds(4), bl);
if (bl->bl_type == BL::PC)
- return bl->as_player()->aspd * 2;
+ return bl->is_player()->aspd * 2;
else
{
eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
interval_t adelay = std::chrono::seconds(4);
int aspd_rate = 100;
if (bl->bl_type == BL::MOB)
- adelay = static_cast<interval_t>(bl->as_mob()->stats[mob_stat::ADELAY]);
+ adelay = static_cast<interval_t>(bl->is_mob()->stats[mob_stat::ADELAY]);
if (sc_data)
{
@@ -731,14 +731,14 @@ interval_t battle_get_amotion(dumb_ptr<block_list> bl)
{
nullpo_retr(std::chrono::seconds(2), bl);
if (bl->bl_type == BL::PC)
- return bl->as_player()->amotion;
+ return bl->is_player()->amotion;
else
{
eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
interval_t amotion = std::chrono::seconds(2);
int aspd_rate = 100;
if (bl->bl_type == BL::MOB)
- amotion = static_cast<interval_t>(mob_db[bl->as_mob()->mob_class].amotion);
+ amotion = static_cast<interval_t>(mob_db[bl->is_mob()->mob_class].amotion);
if (sc_data)
{
@@ -759,11 +759,11 @@ interval_t battle_get_dmotion(dumb_ptr<block_list> bl)
nullpo_retr(interval_t::zero(), bl);
if (bl->bl_type == BL::MOB)
{
- return static_cast<interval_t>(mob_db[bl->as_mob()->mob_class].dmotion);
+ return static_cast<interval_t>(mob_db[bl->is_mob()->mob_class].dmotion);
}
else if (bl->bl_type == BL::PC)
{
- return bl->as_player()->dmotion;
+ return bl->is_player()->dmotion;
}
else
return std::chrono::seconds(2);
@@ -775,7 +775,7 @@ LevelElement battle_get_element(dumb_ptr<block_list> bl)
nullpo_retr(ret, bl);
if (bl->bl_type == BL::MOB) // 10の位=Lv*2、1の位=属性
- ret = bl->as_mob()->def_ele;
+ ret = bl->is_mob()->def_ele;
return ret;
}
@@ -784,10 +784,10 @@ int battle_get_party_id(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::PC)
- return bl->as_player()->status.party_id;
+ return bl->is_player()->status.party_id;
else if (bl->bl_type == BL::MOB)
{
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
if (md->master_id > 0)
return -md->master_id;
return -md->bl_id;
@@ -799,7 +799,7 @@ Race battle_get_race(dumb_ptr<block_list> bl)
{
nullpo_retr(Race::formless, bl);
if (bl->bl_type == BL::MOB)
- return mob_db[bl->as_mob()->mob_class].race;
+ return mob_db[bl->is_mob()->mob_class].race;
else if (bl->bl_type == BL::PC)
return Race::demihuman;
else
@@ -810,7 +810,7 @@ MobMode battle_get_mode(dumb_ptr<block_list> bl)
{
nullpo_retr(MobMode::CAN_MOVE, bl);
if (bl->bl_type == BL::MOB)
- return mob_db[bl->as_mob()->mob_class].mode;
+ return mob_db[bl->is_mob()->mob_class].mode;
// とりあえず動くということで1
return MobMode::CAN_MOVE;
}
@@ -844,9 +844,9 @@ eptr<struct status_change, StatusChange> battle_get_sc_data(dumb_ptr<block_list>
switch (bl->bl_type)
{
case BL::MOB:
- return bl->as_mob()->sc_data;
+ return bl->is_mob()->sc_data;
case BL::PC:
- return bl->as_player()->sc_data;
+ return bl->is_player()->sc_data;
}
return nullptr;
}
@@ -855,9 +855,9 @@ short *battle_get_sc_count(dumb_ptr<block_list> bl)
{
nullpo_retr(NULL, bl);
if (bl->bl_type == BL::MOB)
- return &bl->as_mob()->sc_count;
+ return &bl->is_mob()->sc_count;
else if (bl->bl_type == BL::PC)
- return &bl->as_player()->sc_count;
+ return &bl->is_player()->sc_count;
return NULL;
}
@@ -865,11 +865,11 @@ Opt1 *battle_get_opt1(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::MOB)
- return &bl->as_mob()->opt1;
+ return &bl->is_mob()->opt1;
else if (bl->bl_type == BL::PC)
- return &bl->as_player()->opt1;
+ return &bl->is_player()->opt1;
else if (bl->bl_type == BL::NPC)
- return &bl->as_npc()->opt1;
+ return &bl->is_npc()->opt1;
return 0;
}
@@ -877,11 +877,11 @@ Opt2 *battle_get_opt2(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::MOB)
- return &bl->as_mob()->opt2;
+ return &bl->is_mob()->opt2;
else if (bl->bl_type == BL::PC)
- return &bl->as_player()->opt2;
+ return &bl->is_player()->opt2;
else if (bl->bl_type == BL::NPC)
- return &bl->as_npc()->opt2;
+ return &bl->is_npc()->opt2;
return 0;
}
@@ -889,11 +889,11 @@ Opt3 *battle_get_opt3(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::MOB)
- return &bl->as_mob()->opt3;
+ return &bl->is_mob()->opt3;
else if (bl->bl_type == BL::PC)
- return &bl->as_player()->opt3;
+ return &bl->is_player()->opt3;
else if (bl->bl_type == BL::NPC)
- return &bl->as_npc()->opt3;
+ return &bl->is_npc()->opt3;
return 0;
}
@@ -901,11 +901,11 @@ Option *battle_get_option(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::MOB)
- return &bl->as_mob()->option;
+ return &bl->is_mob()->option;
else if (bl->bl_type == BL::PC)
- return &bl->as_player()->status.option;
+ return &bl->is_player()->status.option;
else if (bl->bl_type == BL::NPC)
- return &bl->as_npc()->option;
+ return &bl->is_npc()->option;
return 0;
}
@@ -942,7 +942,7 @@ int battle_damage(dumb_ptr<block_list> bl, dumb_ptr<block_list> target,
if (target->bl_type == BL::MOB)
{ // MOB
- dumb_ptr<mob_data> md = target->as_mob();
+ dumb_ptr<mob_data> md = target->is_mob();
if (md && md->skilltimer && md->state.skillcastcancel) // 詠唱妨害
skill_castcancel(target, 0);
return mob_damage(bl, md, damage, 0);
@@ -950,7 +950,7 @@ int battle_damage(dumb_ptr<block_list> bl, dumb_ptr<block_list> target,
else if (target->bl_type == BL::PC)
{ // PC
- dumb_ptr<map_session_data> tsd = target->as_player();
+ dumb_ptr<map_session_data> tsd = target->is_player();
return pc_damage(bl, tsd, damage);
@@ -964,7 +964,7 @@ int battle_heal(dumb_ptr<block_list> bl, dumb_ptr<block_list> target, int hp,
nullpo_ret(target); //blはNULLで呼ばれることがあるので他でチェック
if (target->bl_type == BL::PC
- && pc_isdead(target->as_player()))
+ && pc_isdead(target->is_player()))
return 0;
if (hp == 0 && sp == 0)
return 0;
@@ -973,9 +973,9 @@ int battle_heal(dumb_ptr<block_list> bl, dumb_ptr<block_list> target, int hp,
return battle_damage(bl, target, -hp, flag);
if (target->bl_type == BL::MOB)
- return mob_heal(target->as_mob(), hp);
+ return mob_heal(target->is_mob(), hp);
else if (target->bl_type == BL::PC)
- return pc_heal(target->as_player(), hp, sp);
+ return pc_heal(target->is_player(), hp, sp);
return 0;
}
@@ -984,9 +984,9 @@ int battle_stopattack(dumb_ptr<block_list> bl)
{
nullpo_ret(bl);
if (bl->bl_type == BL::MOB)
- return mob_stopattack(bl->as_mob());
+ return mob_stopattack(bl->is_mob());
else if (bl->bl_type == BL::PC)
- return pc_stopattack(bl->as_player());
+ return pc_stopattack(bl->is_player());
return 0;
}
@@ -995,9 +995,9 @@ int battle_stopwalking(dumb_ptr<block_list> bl, int type)
{
nullpo_ret(bl);
if (bl->bl_type == BL::MOB)
- return mob_stop_walking(bl->as_mob(), type);
+ return mob_stop_walking(bl->is_mob(), type);
else if (bl->bl_type == BL::PC)
- return pc_stop_walking(bl->as_player(), type);
+ return pc_stop_walking(bl->is_player(), type);
return 0;
}
@@ -1015,7 +1015,7 @@ int battle_calc_damage(dumb_ptr<block_list>, dumb_ptr<block_list> bl,
nullpo_ret(bl);
if (bl->bl_type == BL::MOB)
- md = bl->as_mob();
+ md = bl->is_mob();
if (battle_config.skill_min_damage
|| bool(flag & BF::MISC))
@@ -1042,7 +1042,7 @@ struct Damage battle_calc_mob_weapon_attack(dumb_ptr<block_list> src,
int skill_lv, int)
{
dumb_ptr<map_session_data> tsd = NULL;
- dumb_ptr<mob_data> md = src->as_mob(), tmd = NULL;
+ dumb_ptr<mob_data> md = src->is_mob(), tmd = NULL;
int hitrate, flee, cri = 0, atkmin, atkmax;
int target_count = 1;
int def1 = battle_get_def(target);
@@ -1065,9 +1065,9 @@ struct Damage battle_calc_mob_weapon_attack(dumb_ptr<block_list> src,
// ターゲット
if (target->bl_type == BL::PC)
- tsd = target->as_player();
+ tsd = target->is_player();
else if (target->bl_type == BL::MOB)
- tmd = target->as_mob();
+ tmd = target->is_mob();
MobMode t_mode = battle_get_mode(target);
t_sc_data = battle_get_sc_data(target);
@@ -1295,7 +1295,7 @@ int battle_is_unarmed(dumb_ptr<block_list> bl)
return 0;
if (bl->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
return (sd->equip_index[EQUIP::SHIELD] == -1
&& sd->equip_index[EQUIP::WEAPON] == -1);
@@ -1315,7 +1315,7 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src,
SkillID skill_num,
int skill_lv, int)
{
- dumb_ptr<map_session_data> sd = src->as_player(), tsd = NULL;
+ dumb_ptr<map_session_data> sd = src->is_player(), tsd = NULL;
dumb_ptr<mob_data> tmd = NULL;
int hitrate, flee, cri = 0, atkmin, atkmax;
int dex, target_count = 1;
@@ -1346,9 +1346,9 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src,
// ターゲット
if (target->bl_type == BL::PC) //対象がPCなら
- tsd = target->as_player(); //tsdに代入(tmdはNULL)
+ tsd = target->is_player(); //tsdに代入(tmdはNULL)
else if (target->bl_type == BL::MOB) //対象がMobなら
- tmd = target->as_mob(); //tmdに代入(tsdはNULL)
+ tmd = target->is_mob(); //tmdに代入(tsdはNULL)
MobMode t_mode = battle_get_mode(target); //対象のMode
t_sc_data = battle_get_sc_data(target); //対象のステータス異常
@@ -1800,7 +1800,7 @@ struct Damage battle_calc_magic_attack(dumb_ptr<block_list> bl,
if (bl->bl_type == BL::PC)
{
- sd = bl->as_player();
+ sd = bl->is_player();
sd->state.attack_type = BF::MAGIC;
if (sd->matk_rate != 100)
{
@@ -1877,7 +1877,7 @@ struct Damage battle_calc_misc_attack(dumb_ptr<block_list> bl,
if (bl->bl_type == BL::PC)
{
- sd = bl->as_player();
+ sd = bl->is_player();
sd->state.attack_type = BF::MISC;
sd->state.arrow_atk = 0;
}
@@ -1967,14 +1967,14 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
nullpo_retr(ATK::ZERO, target);
if (src->bl_type == BL::PC)
- sd = src->as_player();
+ sd = src->is_player();
if (src->bl_prev == NULL || target->bl_prev == NULL)
return ATK::ZERO;
if (src->bl_type == BL::PC && pc_isdead(sd))
return ATK::ZERO;
if (target->bl_type == BL::PC
- && pc_isdead(target->as_player()))
+ && pc_isdead(target->is_player()))
return ATK::ZERO;
Opt1 *opt1 = battle_get_opt1(src);
@@ -2018,7 +2018,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
reduction = wd.damage;
wd.damage -= reduction;
- MAP_LOG_PC(target->as_player(),
+ MAP_LOG_PC(target->is_player(),
"MAGIC-ABSORB-DMG %d", reduction);
}
@@ -2047,7 +2047,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
sd->status.char_id, src->bl_m->name_, src->bl_x, src->bl_y,
(target->bl_type == BL::PC) ? "PC" : "MOB",
(target->bl_type == BL::PC)
- ? target->as_player()-> status.char_id
+ ? target->is_player()-> status.char_id
: target->bl_id,
battle_get_class(target),
wd.damage + wd.damage2, weapon);
@@ -2055,12 +2055,12 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
if (target->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> sd2 = target->as_player();
+ dumb_ptr<map_session_data> sd2 = target->is_player();
MAP_LOG("PC%d %s:%d,%d WPNINJURY %s%d %d FOR %d",
sd2->status.char_id, target->bl_m->name_, target->bl_x, target->bl_y,
(src->bl_type == BL::PC) ? "PC" : "MOB",
(src->bl_type == BL::PC)
- ? src->as_player()->status.char_id
+ ? src->is_player()->status.char_id
: src->bl_id,
battle_get_class(src),
wd.damage + wd.damage2);
@@ -2070,7 +2070,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
if (target->bl_prev != NULL &&
(target->bl_type != BL::PC
|| (target->bl_type == BL::PC
- && !pc_isdead(target->as_player()))))
+ && !pc_isdead(target->is_player()))))
{
if (wd.damage > 0 || wd.damage2 > 0)
{
@@ -2163,13 +2163,13 @@ int battle_check_target(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
}
if (target->bl_type == BL::PC
- && target->as_player()->invincible_timer)
+ && target->is_player()->invincible_timer)
return -1;
// Mobでmaster_idがあってspecial_mob_aiなら、召喚主を求める
if (src->bl_type == BL::MOB)
{
- dumb_ptr<mob_data> md = src->as_mob();
+ dumb_ptr<mob_data> md = src->is_mob();
if (md && md->master_id > 0)
{
if (md->master_id == target->bl_id) // 主なら肯定
@@ -2178,7 +2178,7 @@ int battle_check_target(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
{
if (target->bl_type == BL::MOB)
{ //special_mob_aiで対象がMob
- dumb_ptr<mob_data> tmd = target->as_mob();
+ dumb_ptr<mob_data> tmd = target->is_mob();
if (tmd)
{
if (tmd->master_id != md->master_id) //召喚主が一緒でなければ否定
@@ -2202,11 +2202,11 @@ int battle_check_target(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
return 1;
if (target->bl_type == BL::PC
- && pc_isinvisible(target->as_player()))
+ && pc_isinvisible(target->is_player()))
return -1;
if (src->bl_prev == NULL || // 死んでるならエラー
- (src->bl_type == BL::PC && pc_isdead(src->as_player())))
+ (src->bl_type == BL::PC && pc_isdead(src->is_player())))
return -1;
if ((ss->bl_type == BL::PC && target->bl_type == BL::MOB) ||
@@ -2231,7 +2231,7 @@ int battle_check_target(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
if (ss->bl_type == BL::PC && target->bl_type == BL::PC)
{ // 両方PVPモードなら否定(敵)
if (ss->bl_m->flag.pvp
- || pc_iskiller(ss->as_player(), target->as_player()))
+ || pc_iskiller(ss->is_player(), target->is_player()))
{ // [MouseJstr]
if (battle_config.pk_mode)
return 1; // prevent novice engagement in pk_mode [Valaris]
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index 43608d3..8e62e4d 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -923,7 +923,7 @@ void ladmin_itemfrob_c2(dumb_ptr<block_list> bl, int source_id, int dest_id)
{
case BL::PC:
{
- dumb_ptr<map_session_data> pc = bl->as_player();
+ dumb_ptr<map_session_data> pc = bl->is_player();
struct storage *stor = account2storage2(pc->status.account_id);
int j;
@@ -958,7 +958,7 @@ void ladmin_itemfrob_c2(dumb_ptr<block_list> bl, int source_id, int dest_id)
case BL::MOB:
{
- dumb_ptr<mob_data> mob = bl->as_mob();
+ dumb_ptr<mob_data> mob = bl->is_mob();
for (struct item& itm : mob->lootitemv)
FIX(itm);
break;
@@ -966,7 +966,7 @@ void ladmin_itemfrob_c2(dumb_ptr<block_list> bl, int source_id, int dest_id)
case BL::ITEM:
{
- dumb_ptr<flooritem_data> item = bl->as_item();
+ dumb_ptr<flooritem_data> item = bl->is_item();
FIX(item->item_data);
break;
}
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index c0d4681..1728041 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -196,7 +196,7 @@ int is_deaf(dumb_ptr<block_list> bl)
{
if (!bl || bl->bl_type != BL::PC)
return 0;
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
return sd->special_state.deaf;
}
@@ -224,7 +224,7 @@ void clif_send_sub(dumb_ptr<block_list> bl, const unsigned char *buf, int len,
dumb_ptr<block_list> src_bl, SendWho type)
{
nullpo_retv(bl);
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
switch (type)
{
@@ -236,7 +236,7 @@ void clif_send_sub(dumb_ptr<block_list> bl, const unsigned char *buf, int len,
case SendWho::AREA_CHAT_WOC:
if (is_deaf(bl)
&& !(bl->bl_type == BL::PC
- && pc_isGM(src_bl->as_player())))
+ && pc_isGM(src_bl->is_player())))
{
clif_emotion_towards(src_bl, bl, EMOTE_IGNORED);
return;
@@ -276,7 +276,7 @@ int clif_send(const uint8_t *buf, int len, dumb_ptr<block_list> bl, SendWho type
if (bl->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> sd2 = bl->as_player();
+ dumb_ptr<map_session_data> sd2 = bl->is_player();
if (bool(sd2->status.option & Option::INVISIBILITY))
{
// Obscure hidden GMs
@@ -362,7 +362,7 @@ int clif_send(const uint8_t *buf, int len, dumb_ptr<block_list> bl, SendWho type
case SendWho::PARTY_SAMEMAP_WOS: // 自分以外の同じマップの全パーティーメンバに送信
if (bl->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
if (sd->partyspy > 0)
{
p = party_search(sd->partyspy);
@@ -420,7 +420,7 @@ int clif_send(const uint8_t *buf, int len, dumb_ptr<block_list> bl, SendWho type
break;
case SendWho::SELF:
{
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
if (clif_parse_func_table[RBUFW(buf, 0)].len)
{
// packet must exist
@@ -1815,7 +1815,7 @@ int clif_changelook_towards(dumb_ptr<block_list> bl, LOOK type, int val,
nullpo_ret(bl);
if (bl->bl_type == BL::PC)
- sd = bl->as_player();
+ sd = bl->is_player();
if (sd && bool(sd->status.option & Option::INVISIBILITY))
return 0;
@@ -2604,18 +2604,18 @@ void clif_getareachar(dumb_ptr<block_list> bl, dumb_ptr<map_session_data> sd)
switch (bl->bl_type)
{
case BL::PC:
- if (sd == bl->as_player())
+ if (sd == bl->is_player())
break;
- clif_getareachar_pc(sd, bl->as_player());
+ clif_getareachar_pc(sd, bl->is_player());
break;
case BL::NPC:
- clif_getareachar_npc(sd, bl->as_npc());
+ clif_getareachar_npc(sd, bl->is_npc());
break;
case BL::MOB:
- clif_getareachar_mob(sd, bl->as_mob());
+ clif_getareachar_mob(sd, bl->is_mob());
break;
case BL::ITEM:
- clif_getareachar_item(sd, bl->as_item());
+ clif_getareachar_item(sd, bl->is_item());
break;
case BL::SPELL:
// spell objects are not visible
@@ -2645,7 +2645,7 @@ void clif_pcoutsight(dumb_ptr<block_list> bl, dumb_ptr<map_session_data> sd)
switch (bl->bl_type)
{
case BL::PC:
- dstsd = bl->as_player();
+ dstsd = bl->is_player();
if (sd != dstsd)
{
clif_clearchar_id(dstsd->bl_id, BeingRemoveWhy::GONE, sd->fd);
@@ -2653,14 +2653,14 @@ void clif_pcoutsight(dumb_ptr<block_list> bl, dumb_ptr<map_session_data> sd)
}
break;
case BL::NPC:
- if (bl->as_npc()->npc_class != INVISIBLE_CLASS)
+ if (bl->is_npc()->npc_class != INVISIBLE_CLASS)
clif_clearchar_id(bl->bl_id, BeingRemoveWhy::GONE, sd->fd);
break;
case BL::MOB:
clif_clearchar_id(bl->bl_id, BeingRemoveWhy::GONE, sd->fd);
break;
case BL::ITEM:
- clif_clearflooritem(bl->as_item(), sd->fd);
+ clif_clearflooritem(bl->is_item(), sd->fd);
break;
}
}
@@ -2679,7 +2679,7 @@ void clif_pcinsight(dumb_ptr<block_list> bl, dumb_ptr<map_session_data> sd)
switch (bl->bl_type)
{
case BL::PC:
- dstsd = bl->as_player();
+ dstsd = bl->is_player();
if (sd != dstsd)
{
clif_getareachar_pc(sd, dstsd);
@@ -2687,13 +2687,13 @@ void clif_pcinsight(dumb_ptr<block_list> bl, dumb_ptr<map_session_data> sd)
}
break;
case BL::NPC:
- clif_getareachar_npc(sd, bl->as_npc());
+ clif_getareachar_npc(sd, bl->is_npc());
break;
case BL::MOB:
- clif_getareachar_mob(sd, bl->as_mob());
+ clif_getareachar_mob(sd, bl->is_mob());
break;
case BL::ITEM:
- clif_getareachar_item(sd, bl->as_item());
+ clif_getareachar_item(sd, bl->is_item());
break;
}
}
@@ -2711,7 +2711,7 @@ void clif_moboutsight(dumb_ptr<block_list> bl, dumb_ptr<mob_data> md)
if (bl->bl_type == BL::PC)
{
- sd = bl->as_player();
+ sd = bl->is_player();
clif_clearchar_id(md->bl_id, BeingRemoveWhy::GONE, sd->fd);
}
}
@@ -2729,7 +2729,7 @@ void clif_mobinsight(dumb_ptr<block_list> bl, dumb_ptr<mob_data> md)
if (bl->bl_type == BL::PC)
{
- sd = bl->as_player();
+ sd = bl->is_player();
clif_getareachar_mob(sd, md);
}
}
@@ -3337,7 +3337,7 @@ void clif_emotion_towards(dumb_ptr<block_list> bl,
{
unsigned char buf[8];
int len = clif_parse_func_table[0xc0].len;
- dumb_ptr<map_session_data> sd = target->as_player();
+ dumb_ptr<map_session_data> sd = target->is_player();
nullpo_retv(bl);
nullpo_retv(target);
@@ -3706,7 +3706,7 @@ void clif_parse_GetCharNameRequest(int fd, dumb_ptr<map_session_data> sd)
{
case BL::PC:
{
- dumb_ptr<map_session_data> ssd = bl->as_player();
+ dumb_ptr<map_session_data> ssd = bl->is_player();
nullpo_retv(ssd);
@@ -3758,7 +3758,7 @@ void clif_parse_GetCharNameRequest(int fd, dumb_ptr<map_session_data> sd)
break;
case BL::NPC:
{
- NpcName name = bl->as_npc()->name;
+ NpcName name = bl->is_npc()->name;
// [fate] elim hashed out/invisible names for the client
auto it = std::find(name.begin(), name.end(), '#');
WFIFO_STRING(fd, 6, name.xislice_h(it), 24);
@@ -3767,7 +3767,7 @@ void clif_parse_GetCharNameRequest(int fd, dumb_ptr<map_session_data> sd)
break;
case BL::MOB:
{
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
nullpo_retv(md);
diff --git a/src/map/magic-expr-eval.hpp b/src/map/magic-expr-eval.hpp
index 29fdab6..a4a71f8 100644
--- a/src/map/magic-expr-eval.hpp
+++ b/src/map/magic-expr-eval.hpp
@@ -36,9 +36,9 @@ void magic_area_rect(map_local **m, int *x, int *y, int *width, int *height,
#define ARG_TYPE(x) args[x].ty
#define ENTITY_TYPE(x) ARGENTITY(x)->bl_type
-#define ARGPC(x) (ARGENTITY(x)->as_player())
-#define ARGNPC(x) (ARGENTITY(x)->as_npc())
-#define ARGMOB(x) (ARGENTITY(x)->as_mob())
+#define ARGPC(x) (ARGENTITY(x)->is_player())
+#define ARGNPC(x) (ARGENTITY(x)->is_npc())
+#define ARGMOB(x) (ARGENTITY(x)->is_mob())
#define ARG_MAY_BE_AREA(x) (ARG_TYPE(x) == TYPE::AREA || ARG_TYPE(x) == TYPE::LOCATION)
diff --git a/src/map/magic-expr.cpp b/src/map/magic-expr.cpp
index 8f4a5eb..aff4412 100644
--- a/src/map/magic-expr.cpp
+++ b/src/map/magic-expr.cpp
@@ -97,16 +97,16 @@ FString show_entity(dumb_ptr<block_list> entity)
switch (entity->bl_type)
{
case BL::PC:
- return entity->as_player()->status.name.to__actual();
+ return entity->is_player()->status.name.to__actual();
case BL::NPC:
- return entity->as_npc()->name;
+ return entity->is_npc()->name;
case BL::MOB:
- return entity->as_mob()->name;
+ return entity->is_mob()->name;
case BL::ITEM:
assert (0 && "There is no way this code did what it was supposed to do!");
/* Sorry about this one... */
// WTF? item_data is a struct item, not a struct item_data
- // return ((struct item_data *) (&entity->as_item()->item_data))->name;
+ // return ((struct item_data *) (&entity->is_item()->item_data))->name;
abort();
case BL::SPELL:
return {"%invocation(ERROR:this-should-not-be-an-entity)"};
@@ -168,7 +168,7 @@ void stringify(val_t *v, int within_op)
{
dumb_ptr<invocation> invocation_ = within_op
? v->v.v_invocation
- : map_id2bl(v->v.v_int)->as_spell();
+ : map_id2bl(v->v.v_int)->is_spell();
buf = invocation_->spell->name;
}
break;
@@ -606,7 +606,7 @@ int fun_skill(dumb_ptr<env_t>, val_t *result, const_array<val_t> args)
}
static
-int fun_has_shroud(dumb_ptr<env_t>, val_t *result, const_array<val_t> args)
+int fun_his_shroud(dumb_ptr<env_t>, val_t *result, const_array<val_t> args)
{
RESULTINT = (ENTITY_TYPE(0) == BL::PC && ARGPC(0)->state.shroud_active);
return 0;
@@ -1009,7 +1009,7 @@ int fun_read_script_int(dumb_ptr<env_t>, val_t *result, const_array<val_t> args)
if (subject_p->bl_type != BL::PC)
return 1;
- RESULTINT = pc_readglobalreg(subject_p->as_player(), var_name);
+ RESULTINT = pc_readglobalreg(subject_p->is_player(), var_name);
return 0;
}
@@ -1286,7 +1286,7 @@ std::map<ZString, fun_t> functions =
MAGIC_FUNCTION1(status_option, "ei", 'i'),
MAGIC_FUNCTION1(element, "e", 'i'),
MAGIC_FUNCTION1(element_level, "e", 'i'),
- MAGIC_FUNCTION1(has_shroud, "e", 'i'),
+ MAGIC_FUNCTION1(his_shroud, "e", 'i'),
MAGIC_FUNCTION1(is_equipped, "e.", 'i'),
MAGIC_FUNCTION1(is_exterior, "l", 'i'),
MAGIC_FUNCTION1(contains_string, "ss", 'i'),
@@ -1500,7 +1500,7 @@ int magic_signature_check(ZString opname, ZString funname, ZString signature,
}
else if (ty == TYPE::INVOCATION)
{
- arg->v.v_invocation = map_id2bl(arg->v.v_int)->as_spell();
+ arg->v.v_invocation = map_id2bl(arg->v.v_int)->is_spell();
if (!arg->v.v_entity)
ty = arg->ty = TYPE::FAIL;
}
@@ -1635,7 +1635,7 @@ void magic_eval(dumb_ptr<env_t> env, val_t *dest, dumb_ptr<expr_t> expr)
if (v.ty == TYPE::INVOCATION)
{
- dumb_ptr<invocation> t = map_id2bl(v.v.v_int)->as_spell();
+ dumb_ptr<invocation> t = map_id2bl(v.v.v_int)->is_spell();
if (!t)
dest->ty = TYPE::UNDEF;
diff --git a/src/map/magic-interpreter-base.cpp b/src/map/magic-interpreter-base.cpp
index 09656c6..e86e86b 100644
--- a/src/map/magic-interpreter-base.cpp
+++ b/src/map/magic-interpreter-base.cpp
@@ -415,7 +415,7 @@ void spell_update_location(dumb_ptr<invocation> invocation)
dumb_ptr<block_list> owner_bl = map_id2bl(invocation->subject);
if (!owner_bl)
return;
- dumb_ptr<map_session_data> owner = owner_bl->as_player();
+ dumb_ptr<map_session_data> owner = owner_bl->is_player();
spell_set_location(invocation, owner);
}
diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp
index 2d246de..a0e2b7c 100644
--- a/src/map/magic-stmt.cpp
+++ b/src/map/magic-stmt.cpp
@@ -86,7 +86,7 @@ void clear_activation_record(cont_activation_record_t *ar)
static
void invocation_timer_callback(TimerData *, tick_t, int id)
{
- dumb_ptr<invocation> invocation = map_id_as_spell(id);
+ dumb_ptr<invocation> invocation = map_id_is_spell(id);
assert (invocation);
{
@@ -185,7 +185,7 @@ void magic_stop_completely(dumb_ptr<map_session_data> c)
if (c->attack_spell_override)
{
- dumb_ptr<invocation> attack_spell = map_id_as_spell(c->attack_spell_override);
+ dumb_ptr<invocation> attack_spell = map_id_is_spell(c->attack_spell_override);
if (attack_spell)
spell_free_invocation(attack_spell);
c->attack_spell_override = 0;
@@ -215,14 +215,14 @@ void try_to_finish_invocation(dumb_ptr<invocation> invocation)
static
int trigger_spell(int subject, int spell)
{
- dumb_ptr<invocation> invocation_ = map_id_as_spell(spell);
+ dumb_ptr<invocation> invocation_ = map_id_is_spell(spell);
if (!invocation_)
return 0;
invocation_ = spell_clone_effect(invocation_);
- spell_bind(map_id_as_player(subject), invocation_);
+ spell_bind(map_id_is_player(subject), invocation_);
magic_clear_var(&invocation_->env->varu[VAR_CASTER]);
invocation_->env->varu[VAR_CASTER].ty = TYPE::ENTITY;
invocation_->env->varu[VAR_CASTER].v.v_int = subject;
@@ -269,7 +269,7 @@ void magic_unshroud(dumb_ptr<map_session_data> other_char)
static
void timer_callback_effect_npc_delete(TimerData *, tick_t, int npc_id)
{
- dumb_ptr<npc_data> effect_npc = map_id_as_npc(npc_id);
+ dumb_ptr<npc_data> effect_npc = map_id_is_npc(npc_id);
npc_free(effect_npc);
}
@@ -324,8 +324,8 @@ int op_instaheal(dumb_ptr<env_t> env, const_array<val_t> args)
if (caster->bl_type == BL::PC && subject->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> caster_pc = caster->as_player();
- dumb_ptr<map_session_data> subject_pc = subject->as_player();
+ dumb_ptr<map_session_data> caster_pc = caster->is_player();
+ dumb_ptr<map_session_data> subject_pc = subject->is_player();
MAP_LOG_PC(caster_pc, "SPELLHEAL-INSTA PC%d FOR %d",
subject_pc->status.char_id, ARGINT(1));
}
@@ -340,7 +340,7 @@ int op_itemheal(dumb_ptr<env_t> env, const_array<val_t> args)
dumb_ptr<block_list> subject = ARGENTITY(0);
if (subject->bl_type == BL::PC)
{
- pc_itemheal(subject->as_player(),
+ pc_itemheal(subject->is_player(),
ARGINT(1), ARGINT(2));
}
else
@@ -408,7 +408,7 @@ int op_message(dumb_ptr<env_t>, const_array<val_t> args)
static
void timer_callback_kill_npc(TimerData *, tick_t, int npc_id)
{
- dumb_ptr<npc_data> npc = map_id_as_npc(npc_id);
+ dumb_ptr<npc_data> npc = map_id_is_npc(npc_id);
if (npc)
npc_free(npc);
}
@@ -441,7 +441,7 @@ void entity_warp(dumb_ptr<block_list> target, map_local *destm, int destx, int d
{
case BL::PC:
{
- dumb_ptr<map_session_data> character = target->as_player();
+ dumb_ptr<map_session_data> character = target->is_player();
clif_clearchar(character, BeingRemoveWhy::WARPED);
map_delblock(character);
character->bl_x = destx;
@@ -464,7 +464,7 @@ void entity_warp(dumb_ptr<block_list> target, map_local *destm, int destx, int d
target->bl_x = destx;
target->bl_y = desty;
target->bl_m = destm;
- clif_fixmobpos(target->as_mob());
+ clif_fixmobpos(target->is_mob());
break;
}
}
@@ -503,7 +503,7 @@ int op_banish(dumb_ptr<env_t>, const_array<val_t> args)
if (subject->bl_type == BL::MOB)
{
- dumb_ptr<mob_data> mob = subject->as_mob();
+ dumb_ptr<mob_data> mob = subject->is_mob();
if (bool(mob->mode & MobMode::SUMMONED))
mob_catch_delete(mob, BeingRemoveWhy::WARPED);
@@ -529,7 +529,7 @@ int op_status_change(dumb_ptr<env_t> env, const_array<val_t> args)
dumb_ptr<block_list> subject = ARGENTITY(0);
int invocation_id = env->VAR(VAR_INVOCATION).ty == TYPE::INVOCATION
? env->VAR(VAR_INVOCATION).v.v_int : 0;
- dumb_ptr<invocation> invocation_ = map_id_as_spell(invocation_id);
+ dumb_ptr<invocation> invocation_ = map_id_is_spell(invocation_id);
assert (!ARGINT(3));
assert (!ARGINT(4));
@@ -570,11 +570,11 @@ int op_override_attack(dumb_ptr<env_t> env, const_array<val_t> args)
if (psubject->bl_type != BL::PC)
return 0;
- subject = psubject->as_player();
+ subject = psubject->is_player();
if (subject->attack_spell_override)
{
- dumb_ptr<invocation> old_invocation = map_id_as_spell(subject->attack_spell_override);
+ dumb_ptr<invocation> old_invocation = map_id_is_spell(subject->attack_spell_override);
if (old_invocation)
spell_free_invocation(old_invocation);
}
@@ -585,7 +585,7 @@ int op_override_attack(dumb_ptr<env_t> env, const_array<val_t> args)
if (subject->attack_spell_override)
{
- dumb_ptr<invocation> attack_spell = map_id_as_spell(subject->attack_spell_override);
+ dumb_ptr<invocation> attack_spell = map_id_is_spell(subject->attack_spell_override);
if (attack_spell && stopattack)
attack_spell->flags |= INVOCATION_FLAG::STOPATTACK;
@@ -608,7 +608,7 @@ int op_create_item(dumb_ptr<env_t>, const_array<val_t> args)
return 0;
if (entity->bl_type == BL::PC)
- subject = entity->as_player();
+ subject = entity->is_player();
else
return 0;
@@ -643,7 +643,7 @@ int op_aggravate(dumb_ptr<env_t>, const_array<val_t> args)
dumb_ptr<mob_data> other;
if (target->bl_type == BL::MOB)
- other = target->as_mob();
+ other = target->is_mob();
else
return 0;
@@ -683,7 +683,7 @@ int op_spawn(dumb_ptr<env_t>, const_array<val_t> args)
dumb_ptr<map_session_data> owner = NULL;
if (monster_attitude == MonsterAttitude::SERVANT
&& owner_e->bl_type == BL::PC)
- owner = owner_e->as_player();
+ owner = owner_e->is_player();
for (i = 0; i < monster_count; i++)
{
@@ -696,7 +696,7 @@ int op_spawn(dumb_ptr<env_t>, const_array<val_t> args)
mob_id = mob_once_spawn(owner, loc.m->name_, loc.x, loc.y, JAPANESE_NAME, // Is that needed?
monster_id, 1, NpcEvent());
- mob = map_id_as_mob(mob_id);
+ mob = map_id_is_mob(mob_id);
if (mob)
{
@@ -752,7 +752,7 @@ const char *get_invocation_name(dumb_ptr<env_t> env)
if (env->VAR(VAR_INVOCATION).ty != TYPE::INVOCATION)
return "?";
- invocation_ = map_id_as_spell(env->VAR(VAR_INVOCATION).v.v_int);
+ invocation_ = map_id_is_spell(env->VAR(VAR_INVOCATION).v.v_int);
if (invocation_)
return invocation_->spell->name.c_str();
@@ -772,8 +772,8 @@ int op_injure(dumb_ptr<env_t> env, const_array<val_t> args)
if (target->bl_type == BL::PC
&& !target->bl_m->flag.pvp
- && !target->as_player()->special_state.killable
- && (caster->bl_type != BL::PC || !caster->as_player()->special_state.killer))
+ && !target->is_player()->special_state.killable
+ && (caster->bl_type != BL::PC || !caster->is_player()->special_state.killer))
return 0; /* Cannot damage other players outside of pvp */
if (target != caster)
@@ -795,10 +795,10 @@ int op_injure(dumb_ptr<env_t> env, const_array<val_t> args)
if (caster->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> caster_pc = caster->as_player();
+ dumb_ptr<map_session_data> caster_pc = caster->is_player();
if (target->bl_type == BL::MOB)
{
- dumb_ptr<mob_data> mob = target->as_mob();
+ dumb_ptr<mob_data> mob = target->is_mob();
MAP_LOG_PC(caster_pc, "SPELLDMG MOB%d %d FOR %d BY %s",
mob->bl_id, mob->mob_class, damage_caused,
@@ -941,7 +941,7 @@ op_t *magic_get_op(ZString name)
void spell_effect_report_termination(int invocation_id, int bl_id,
StatusChange sc_id, int)
{
- dumb_ptr<invocation> invocation_ = map_id_as_spell(invocation_id);
+ dumb_ptr<invocation> invocation_ = map_id_is_spell(invocation_id);
if (!invocation_ || invocation_->bl_type != BL::SPELL)
return;
@@ -1091,7 +1091,7 @@ void find_entities_in_area_c(dumb_ptr<block_list> target,
break;
else if (filter == FOREACH_FILTER::SPELL)
{ /* Check all spells bound to the caster */
- dumb_ptr<invocation> invoc = target->as_player()->active_spells;
+ dumb_ptr<invocation> invoc = target->is_player()->active_spells;
/* Add all spells locked onto thie PC */
while (invoc)
@@ -1113,7 +1113,7 @@ void find_entities_in_area_c(dumb_ptr<block_list> target,
case BL::SPELL:
if (filter == FOREACH_FILTER::SPELL)
{
- dumb_ptr<invocation> invocation = target->as_spell();
+ dumb_ptr<invocation> invocation = target->is_spell();
/* Check whether the spell is `bound'-- if so, we'll consider it iff we see the caster(case BL::PC). */
if (bool(invocation->flags & INVOCATION_FLAG::BOUND))
@@ -1351,7 +1351,7 @@ static
interval_t spell_run(dumb_ptr<invocation> invocation_, int allow_delete)
{
const int invocation_id = invocation_->bl_id;
-#define REFRESH_INVOCATION invocation_ = map_id_as_spell(invocation_id); if (!invocation_) return interval_t::zero();
+#define REFRESH_INVOCATION invocation_ = map_id_is_spell(invocation_id); if (!invocation_) return interval_t::zero();
#ifdef DEBUG
FPRINTF(stderr, "Resuming execution: invocation of `%s'\n",
@@ -1416,7 +1416,7 @@ interval_t spell_run(dumb_ptr<invocation> invocation_, int allow_delete)
case EFFECT::SCRIPT:
{
- dumb_ptr<map_session_data> caster = map_id_as_player(invocation_->caster);
+ dumb_ptr<map_session_data> caster = map_id_is_player(invocation_->caster);
if (caster)
{
dumb_ptr<env_t> env = invocation_->env;
@@ -1431,7 +1431,7 @@ interval_t spell_run(dumb_ptr<invocation> invocation_, int allow_delete)
env->VAR(VAR_SCRIPTTARGET).ty ==
TYPE::ENTITY ? env->VAR(VAR_SCRIPTTARGET).
v.v_int : invocation_->caster;
- dumb_ptr<map_session_data> recipient = map_id_as_player(message_recipient);
+ dumb_ptr<map_session_data> recipient = map_id_is_player(message_recipient);
if (recipient->npc_id
&& recipient->npc_id != invocation_->bl_id)
@@ -1544,14 +1544,14 @@ void spell_execute_script(dumb_ptr<invocation> invocation)
int spell_attack(int caster_id, int target_id)
{
- dumb_ptr<map_session_data> caster = map_id_as_player(caster_id);
+ dumb_ptr<map_session_data> caster = map_id_is_player(caster_id);
dumb_ptr<invocation> invocation_;
int stop_attack = 0;
if (!caster)
return 0;
- invocation_ = map_id_as_spell(caster->attack_spell_override);
+ invocation_ = map_id_is_spell(caster->attack_spell_override);
if (invocation_ && bool(invocation_->flags & INVOCATION_FLAG::STOPATTACK))
stop_attack = 1;
@@ -1568,7 +1568,7 @@ int spell_attack(int caster_id, int target_id)
0 /* don't delete the invocation if done */ );
// If the caster died, we need to refresh here:
- invocation_ = map_id_as_spell(caster->attack_spell_override);
+ invocation_ = map_id_is_spell(caster->attack_spell_override);
if (invocation_ && !bool(invocation_->flags & INVOCATION_FLAG::ABORTED)) // If we didn't abort:
caster->attack_spell_charges--;
diff --git a/src/map/map.cpp b/src/map/map.cpp
index f8bda41..1f44747 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -582,7 +582,7 @@ int map_delobject(int id, BL type)
map_delobjectnofree(id, type);
if (obj->bl_type == BL::PC) // [Fate] Not sure where else to put this... I'm not sure where delobject for PCs is called from
- pc_cleanup(obj->as_player());
+ pc_cleanup(obj->is_player());
MapBlockLock::freeblock(obj);
@@ -630,7 +630,7 @@ void map_clearflooritem_timer(TimerData *tid, tick_t, int id)
{
dumb_ptr<block_list> obj = object[id];
assert (obj && obj->bl_type == BL::ITEM);
- dumb_ptr<flooritem_data> fitem = obj->as_item();
+ dumb_ptr<flooritem_data> fitem = obj->is_item();
if (!tid)
fitem->cleartimer.cancel();
clif_clearflooritem(fitem, 0);
@@ -1569,16 +1569,16 @@ void cleanup_sub(dumb_ptr<block_list> bl)
map_delblock(bl); // There is something better...
break;
case BL::NPC:
- npc_delete(bl->as_npc());
+ npc_delete(bl->is_npc());
break;
case BL::MOB:
- mob_delete(bl->as_mob());
+ mob_delete(bl->is_mob());
break;
case BL::ITEM:
map_clearflooritem(bl->bl_id);
break;
case BL::SPELL:
- spell_free_invocation(bl->as_spell());
+ spell_free_invocation(bl->is_spell());
break;
}
}
@@ -1703,7 +1703,7 @@ int map_scriptcont(dumb_ptr<map_session_data> sd, int id)
case BL::NPC:
return npc_scriptcont(sd, id);
case BL::SPELL:
- spell_execute_script(bl->as_spell());
+ spell_execute_script(bl->is_spell());
break;
}
diff --git a/src/map/map.hpp b/src/map/map.hpp
index 356e077..e288d36 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -90,12 +90,15 @@ struct block_list
block_list& operator = (block_list&&) = delete;
virtual ~block_list() {}
+private:
+ // historically, a lot of code used this.
+ // historically, a lot of code crashed.
dumb_ptr<map_session_data> as_player();
dumb_ptr<npc_data> as_npc();
dumb_ptr<mob_data> as_mob();
dumb_ptr<flooritem_data> as_item();
dumb_ptr<invocation> as_spell();
-
+public:
dumb_ptr<map_session_data> is_player();
dumb_ptr<npc_data> is_npc();
dumb_ptr<mob_data> is_mob();
@@ -346,11 +349,12 @@ struct npc_data : block_list
Timer eventtimer[MAX_EVENTTIMER];
short arenaflag;
+private:
dumb_ptr<npc_data_script> as_script();
dumb_ptr<npc_data_shop> as_shop();
dumb_ptr<npc_data_warp> as_warp();
dumb_ptr<npc_data_message> as_message();
-
+public:
dumb_ptr<npc_data_script> is_script();
dumb_ptr<npc_data_shop> is_shop();
dumb_ptr<npc_data_warp> is_warp();
@@ -652,37 +656,6 @@ dumb_ptr<map_session_data> map_id2sd(int);
dumb_ptr<block_list> map_id2bl(int);
inline
-dumb_ptr<map_session_data> map_id_as_player(int id)
-{
- dumb_ptr<block_list> bl = map_id2bl(id);
- return bl ? bl->as_player() : nullptr;
-}
-inline
-dumb_ptr<npc_data> map_id_as_npc(int id)
-{
- dumb_ptr<block_list> bl = map_id2bl(id);
- return bl ? bl->as_npc() : nullptr;
-}
-inline
-dumb_ptr<mob_data> map_id_as_mob(int id)
-{
- dumb_ptr<block_list> bl = map_id2bl(id);
- return bl ? bl->as_mob() : nullptr;
-}
-inline
-dumb_ptr<flooritem_data> map_id_as_item(int id)
-{
- dumb_ptr<block_list> bl = map_id2bl(id);
- return bl ? bl->as_item() : nullptr;
-}
-inline
-dumb_ptr<invocation> map_id_as_spell(int id)
-{
- dumb_ptr<block_list> bl = map_id2bl(id);
- return bl ? bl->as_spell() : nullptr;
-}
-
-inline
dumb_ptr<map_session_data> map_id_is_player(int id)
{
dumb_ptr<block_list> bl = map_id2bl(id);
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index 09107ed..1885fbd 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -689,9 +689,9 @@ int mob_check_attack(dumb_ptr<mob_data> md)
}
if (tbl->bl_type == BL::PC)
- tsd = tbl->as_player();
+ tsd = tbl->is_player();
else if (tbl->bl_type == BL::MOB)
- tmd = tbl->as_mob();
+ tmd = tbl->is_mob();
else
return 0;
@@ -907,7 +907,7 @@ void mob_timer(TimerData *, tick_t tick, int id, unsigned char data)
if (bl->bl_type == BL::NUL || bl->bl_type != BL::MOB)
return;
- md = bl->as_mob();
+ md = bl->is_mob();
if (md->bl_prev == NULL || md->state.state == MS::DEAD)
return;
@@ -1009,7 +1009,7 @@ int mob_setdelayspawn(int id)
if (!bl || bl->bl_type == BL::NUL || bl->bl_type != BL::MOB)
return -1;
- md = bl->as_mob();
+ md = bl->is_mob();
nullpo_retr(-1, md);
if (!md || md->bl_type != BL::MOB)
@@ -1055,7 +1055,7 @@ int mob_spawn(int id)
if (!bl || bl->bl_type == BL::NUL || bl->bl_type != BL::MOB)
return -1;
- md = bl->as_mob();
+ md = bl->is_mob();
nullpo_retr(-1, md);
if (!md || md->bl_type == BL::NUL || md->bl_type != BL::MOB)
@@ -1255,7 +1255,7 @@ int mob_can_reach(dumb_ptr<mob_data> md, dumb_ptr<block_list> bl, int range)
if (bl->bl_type == BL::PC && battle_config.monsters_ignore_gm == 1)
{ // option to have monsters ignore GMs [Valaris]
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
if (pc_isGM(sd))
return 0;
}
@@ -1338,7 +1338,7 @@ int mob_target(dumb_ptr<mob_data> md, dumb_ptr<block_list> bl, int dist)
{
if (bl->bl_type == BL::PC)
{
- sd = bl->as_player();
+ sd = bl->is_player();
nullpo_ret(sd);
if (sd->invincible_timer || pc_isinvisible(sd))
return 0;
@@ -1377,9 +1377,9 @@ void mob_ai_sub_hard_activesearch(dumb_ptr<block_list> bl,
nullpo_retv(pcc);
if (bl->bl_type == BL::PC)
- tsd = bl->as_player();
+ tsd = bl->is_player();
else if (bl->bl_type == BL::MOB)
- tmd = bl->as_mob();
+ tmd = bl->is_mob();
else
return;
@@ -1490,7 +1490,7 @@ void mob_ai_sub_hard_linksearch(dumb_ptr<block_list> bl, dumb_ptr<mob_data> md,
dumb_ptr<mob_data> tmd;
nullpo_retv(bl);
- tmd = bl->as_mob();
+ tmd = bl->is_mob();
nullpo_retv(md);
nullpo_retv(target);
@@ -1527,7 +1527,7 @@ int mob_ai_sub_hard_slavemob(dumb_ptr<mob_data> md, tick_t tick)
nullpo_ret(md);
if ((bl = map_id2bl(md->master_id)) != NULL)
- mmd = bl->as_mob();
+ mmd = bl->is_mob();
mode = mob_db[md->mob_class].mode;
@@ -1733,7 +1733,7 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick)
MobMode mode;
nullpo_retv(bl);
- md = bl->as_mob();
+ md = bl->is_mob();
if (tick < md->last_thinktime + MIN_MOBTHINKTIME)
return;
@@ -1787,7 +1787,7 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick)
if (abl)
{
if (abl->bl_type == BL::PC)
- asd = abl->as_player();
+ asd = abl->is_player();
if (asd == NULL || md->bl_m != abl->bl_m || abl->bl_prev == NULL
|| asd->invincible_timer || pc_isinvisible(asd)
|| (dist =
@@ -1855,9 +1855,9 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick)
if ((tbl = map_id2bl(md->target_id)))
{
if (tbl->bl_type == BL::PC)
- tsd = tbl->as_player();
+ tsd = tbl->is_player();
else if (tbl->bl_type == BL::MOB)
- tmd = tbl->as_mob();
+ tmd = tbl->is_mob();
if (tsd || tmd)
{
if (tbl->bl_m != md->bl_m || tbl->bl_prev == NULL
@@ -1988,7 +1988,7 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick)
return; // 攻撃中
if (md->state.state == MS::WALK)
mob_stop_walking(md, 1); // 歩行中なら停止
- fitem = tbl->as_item();
+ fitem = tbl->is_item();
md->lootitemv.push_back(fitem->item_data);
map_clearflooritem(tbl->bl_id);
mob_unlocktarget(md, tick);
@@ -2074,7 +2074,7 @@ void mob_ai_sub_lazy(dumb_ptr<block_list> bl, tick_t tick)
if (bl->bl_type != BL::MOB)
return;
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
if (tick < md->last_thinktime + MIN_MOBTHINKTIME * 10)
return;
@@ -2259,7 +2259,7 @@ void mob_timer_delete(TimerData *, tick_t, int id)
nullpo_retv(bl);
- md = bl->as_mob();
+ md = bl->is_mob();
mob_catch_delete(md, BeingRemoveWhy::WARPED);
}
@@ -2273,7 +2273,7 @@ void mob_deleteslave_sub(dumb_ptr<block_list> bl, int id)
dumb_ptr<mob_data> md;
nullpo_retv(bl);
- md = bl->as_mob();
+ md = bl->is_mob();
if (md->master_id > 0 && md->master_id == id)
mob_damage(NULL, md, md->hp, 1);
@@ -2331,7 +2331,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage,
if (src && src->bl_type == BL::PC)
{
- sd = src->as_player();
+ sd = src->is_player();
mvp_sd = sd;
}
@@ -2395,13 +2395,13 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage,
md->attacked_id = sd->bl_id;
}
if (src && src->bl_type == BL::MOB
- && src->as_mob()->state.special_mob_ai)
+ && src->is_mob()->state.special_mob_ai)
{
- dumb_ptr<mob_data> md2 = src->as_mob();
+ dumb_ptr<mob_data> md2 = src->is_mob();
dumb_ptr<block_list> master_bl = map_id2bl(md2->master_id);
if (master_bl && master_bl->bl_type == BL::PC)
{
- MAP_LOG_PC(master_bl->as_player(),
+ MAP_LOG_PC(master_bl->is_player(),
"MOB-TO-MOB-DMG FROM MOB%d %d TO MOB%d %d FOR %d",
md2->bl_id, md2->mob_class, md->bl_id, md->mob_class,
damage);
@@ -2450,7 +2450,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage,
max_hp = battle_get_max_hp(md);
if (src && src->bl_type == BL::MOB)
- mob_unlocktarget(src->as_mob(), tick);
+ mob_unlocktarget(src->is_mob(), tick);
// map外に消えた人は計算から除くので
// overkill分は無いけどsumはmax_hpとは違う
@@ -2703,7 +2703,7 @@ int mob_heal(dumb_ptr<mob_data> md, int heal)
static
void mob_warpslave_sub(dumb_ptr<block_list> bl, int id, int x, int y)
{
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
if (md->master_id == id)
{
@@ -2821,7 +2821,7 @@ void mob_countslave_sub(dumb_ptr<block_list> bl, int id, int *c)
dumb_ptr<mob_data> md;
nullpo_retv(bl);
- md = bl->as_mob();
+ md = bl->is_mob();
if (md->master_id == id)
(*c)++;
@@ -2939,14 +2939,14 @@ void mob_counttargeted_sub(dumb_ptr<block_list> bl,
return;
if (bl->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
if (sd && sd->attacktarget == id && sd->attacktimer
&& sd->attacktarget_lv >= target_lv)
(*c)++;
}
else if (bl->bl_type == BL::MOB)
{
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
if (md && md->target_id == id && md->timer
&& md->state.state == MS::ATTACK && md->target_lv >= target_lv)
(*c)++;
@@ -2989,7 +2989,7 @@ void mobskill_castend_id(TimerData *, tick_t tick, int id)
if ((mbl = map_id2bl(id)) == NULL) //詠唱したMobがもういないというのは良くある正常処理
return;
- if ((md = mbl->as_mob()) == NULL)
+ if ((md = mbl->is_mob()) == NULL)
{
PRINTF("mobskill_castend_id nullpo mbl->bl_id:%d\n", mbl->bl_id);
return;
@@ -3057,7 +3057,7 @@ void mobskill_castend_pos(TimerData *, tick_t tick, int id)
if ((bl = map_id2bl(id)) == NULL)
return;
- md = bl->as_mob();
+ md = bl->is_mob();
nullpo_retv(md);
if (md->bl_type != BL::MOB || md->bl_prev == NULL)
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index 28f348e..e3038a1 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -73,7 +73,7 @@ void npc_enable_sub(dumb_ptr<block_list> bl, dumb_ptr<npc_data> nd)
assert (bl->bl_type == BL::PC);
{
- sd = bl->as_player();
+ sd = bl->is_player();
// not if disabled
if (nd->flag & 1)
@@ -298,7 +298,7 @@ int npc_event_do_oninit(void)
static
void npc_timerevent(TimerData *, tick_t tick, int id, interval_t data)
{
- dumb_ptr<npc_data_script> nd = map_id2bl(id)->as_npc()->as_script();
+ dumb_ptr<npc_data_script> nd = map_id2bl(id)->is_npc()->is_script();
assert (nd != NULL);
assert (nd->npc_subtype == NpcSubtype::SCRIPT);
assert (nd->scr.next_event != nd->scr.timer_eventv.end());
@@ -537,8 +537,8 @@ int npc_touch_areanpc(dumb_ptr<map_session_data> sd, map_local *m, int x, int y)
switch (m->npc[i]->npc_subtype)
{
case NpcSubtype::WARP:
- xs = m->npc[i]->as_warp()->warp.xs;
- ys = m->npc[i]->as_warp()->warp.ys;
+ xs = m->npc[i]->is_warp()->warp.xs;
+ ys = m->npc[i]->is_warp()->warp.ys;
break;
case NpcSubtype::MESSAGE:
assert (0 && "I'm pretty sure these are never put on a map");
@@ -546,8 +546,8 @@ int npc_touch_areanpc(dumb_ptr<map_session_data> sd, map_local *m, int x, int y)
ys = 0;
break;
case NpcSubtype::SCRIPT:
- xs = m->npc[i]->as_script()->scr.xs;
- ys = m->npc[i]->as_script()->scr.ys;
+ xs = m->npc[i]->is_script()->scr.xs;
+ ys = m->npc[i]->is_script()->scr.ys;
break;
default:
continue;
@@ -571,8 +571,8 @@ int npc_touch_areanpc(dumb_ptr<map_session_data> sd, map_local *m, int x, int y)
{
case NpcSubtype::WARP:
skill_stop_dancing(sd, 0);
- pc_setpos(sd, m->npc[i]->as_warp()->warp.name,
- m->npc[i]->as_warp()->warp.x, m->npc[i]->as_warp()->warp.y, BeingRemoveWhy::GONE);
+ pc_setpos(sd, m->npc[i]->is_warp()->warp.name,
+ m->npc[i]->is_warp()->warp.x, m->npc[i]->is_warp()->warp.y, BeingRemoveWhy::GONE);
break;
case NpcSubtype::MESSAGE:
assert (0 && "I'm pretty sure these NPCs are never put on a map.");
@@ -606,7 +606,7 @@ int npc_checknear(dumb_ptr<map_session_data> sd, int id)
nullpo_ret(sd);
- nd = map_id_as_npc(id);
+ nd = map_id_is_npc(id);
// this actually happens
if (nd == NULL)
return 1;
@@ -649,7 +649,7 @@ int npc_click(dumb_ptr<map_session_data> sd, int id)
return 1;
}
- nd = map_id_as_npc(id);
+ nd = map_id_is_npc(id);
if (nd->flag & 1) // 無効化されている
return 1;
@@ -662,12 +662,12 @@ int npc_click(dumb_ptr<map_session_data> sd, int id)
npc_event_dequeue(sd);
break;
case NpcSubtype::SCRIPT:
- sd->npc_pos = run_script(ScriptPointer(nd->as_script()->scr.script.get(), 0), sd->bl_id, id);
+ sd->npc_pos = run_script(ScriptPointer(nd->is_script()->scr.script.get(), 0), sd->bl_id, id);
break;
case NpcSubtype::MESSAGE:
- if (nd->as_message()->message)
+ if (nd->is_message()->message)
{
- clif_scriptmes(sd, id, nd->as_message()->message);
+ clif_scriptmes(sd, id, nd->is_message()->message);
clif_scriptclose(sd, id);
}
break;
@@ -694,7 +694,7 @@ int npc_scriptcont(dumb_ptr<map_session_data> sd, int id)
return 1;
}
- nd = map_id_as_npc(id);
+ nd = map_id_is_npc(id);
if (!nd /* NPC was disposed? */ || nd->npc_subtype == NpcSubtype::MESSAGE)
{
@@ -703,7 +703,7 @@ int npc_scriptcont(dumb_ptr<map_session_data> sd, int id)
return 0;
}
- sd->npc_pos = run_script(ScriptPointer(nd->as_script()->scr.script.get(), sd->npc_pos), sd->bl_id, id);
+ sd->npc_pos = run_script(ScriptPointer(nd->is_script()->scr.script.get(), sd->npc_pos), sd->bl_id, id);
return 0;
}
@@ -721,7 +721,7 @@ int npc_buysellsel(dumb_ptr<map_session_data> sd, int id, int type)
if (npc_checknear(sd, id))
return 1;
- nd = map_id_as_npc(id);
+ nd = map_id_is_npc(id);
if (nd->npc_subtype != NpcSubtype::SHOP)
{
if (battle_config.error_log)
@@ -735,7 +735,7 @@ int npc_buysellsel(dumb_ptr<map_session_data> sd, int id, int type)
sd->npc_shopid = id;
if (type == 0)
{
- clif_buylist(sd, nd->as_shop());
+ clif_buylist(sd, nd->is_shop());
}
else
{
@@ -762,21 +762,21 @@ int npc_buylist(dumb_ptr<map_session_data> sd, int n,
if (npc_checknear(sd, sd->npc_shopid))
return 3;
- nd = map_id_as_npc(sd->npc_shopid);
+ nd = map_id_is_npc(sd->npc_shopid);
if (nd->npc_subtype != NpcSubtype::SHOP)
return 3;
for (i = 0, w = 0, z = 0; i < n; i++)
{
- for (j = 0; j < nd->as_shop()->shop_items.size(); j++)
+ for (j = 0; j < nd->is_shop()->shop_items.size(); j++)
{
- if (nd->as_shop()->shop_items[j].nameid == item_list[i * 2 + 1])
+ if (nd->is_shop()->shop_items[j].nameid == item_list[i * 2 + 1])
break;
}
- if (j == nd->as_shop()->shop_items.size())
+ if (j == nd->is_shop()->shop_items.size())
return 3;
- z += static_cast<double>(nd->as_shop()->shop_items[j].value) * item_list[i * 2];
+ z += static_cast<double>(nd->is_shop()->shop_items[j].value) * item_list[i * 2];
itemamount += item_list[i * 2];
switch (pc_checkadditem(sd, item_list[i * 2 + 1], item_list[i * 2]))
@@ -1667,7 +1667,7 @@ void npc_free_internal(dumb_ptr<npc_data> nd_)
{
if (nd_->npc_subtype == NpcSubtype::SCRIPT)
{
- dumb_ptr<npc_data_script> nd = nd_->as_script();
+ dumb_ptr<npc_data_script> nd = nd_->is_script();
nd->scr.timer_eventv.clear();
{
@@ -1677,7 +1677,7 @@ void npc_free_internal(dumb_ptr<npc_data> nd_)
}
else if (nd_->npc_subtype == NpcSubtype::MESSAGE)
{
- dumb_ptr<npc_data_message> nd = nd_->as_message();
+ dumb_ptr<npc_data_message> nd = nd_->is_message();
nd->message = FString();
}
nd_.delete_();
diff --git a/src/map/party.cpp b/src/map/party.cpp
index d0039de..0ba251f 100644
--- a/src/map/party.cpp
+++ b/src/map/party.cpp
@@ -685,7 +685,7 @@ void party_send_hp_check(dumb_ptr<block_list> bl, int party_id, int *flag)
dumb_ptr<map_session_data> sd;
nullpo_retv(bl);
- sd = bl->as_player();
+ sd = bl->is_player();
if (sd->status.party_id == party_id)
{
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index cf953aa..8750910 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -362,14 +362,14 @@ void pc_counttargeted_sub(dumb_ptr<block_list> bl,
return;
if (bl->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
if (sd->attacktarget == id && sd->attacktimer
&& sd->attacktarget_lv >= target_lv)
(*c)++;
}
else if (bl->bl_type == BL::MOB)
{
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
if (md->target_id == id && md->timer
&& md->state.state == MS::ATTACK && md->target_lv >= target_lv)
@@ -2775,7 +2775,7 @@ void pc_attack_timer(TimerData *, tick_t tick, int id)
if (bl == NULL || bl->bl_prev == NULL)
return;
- if (bl->bl_type == BL::PC && pc_isdead(bl->as_player()))
+ if (bl->bl_type == BL::PC && pc_isdead(bl->is_player()))
return;
// 同じmapでないなら攻撃しない
@@ -3427,7 +3427,7 @@ int pc_damage(dumb_ptr<block_list> src, dumb_ptr<map_session_data> sd,
if (src->bl_type == BL::PC)
{
MAP_LOG_PC(sd, "INJURED-BY PC%d FOR %d",
- src->as_player()->status.char_id,
+ src->is_player()->status.char_id,
damage);
}
else
@@ -3550,7 +3550,7 @@ int pc_damage(dumb_ptr<block_list> src, dumb_ptr<map_session_data> sd,
{
sd->pvp_point -= 5;
if (src && src->bl_type == BL::PC)
- src->as_player()->pvp_point++;
+ src->is_player()->pvp_point++;
pc_setdead(sd);
}
// 強制送還
@@ -4747,7 +4747,7 @@ void pc_calc_pvprank_sub(dumb_ptr<block_list> bl, dumb_ptr<map_session_data> sd2
dumb_ptr<map_session_data> sd1;
nullpo_retv(bl);
- sd1 = bl->as_player();
+ sd1 = bl->is_player();
nullpo_retv(sd2);
if (sd1->pvp_point > sd2->pvp_point)
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 55e6b53..07a1ea1 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -1468,7 +1468,7 @@ void builtin_warp(ScriptState *st)
static
void builtin_areawarp_sub(dumb_ptr<block_list> bl, MapName mapname, int x, int y)
{
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
if (mapname == "Random")
pc_randomwarp(sd, BeingRemoveWhy::WARPED);
else
@@ -2581,7 +2581,7 @@ void builtin_areamonster(ScriptState *st)
static
void builtin_killmonster_sub(dumb_ptr<block_list> bl, NpcEvent event)
{
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
if (event)
{
if (event == md->npc_event)
@@ -2619,7 +2619,7 @@ void builtin_killmonster(ScriptState *st)
static
void builtin_killmonsterall_sub(dumb_ptr<block_list> bl)
{
- mob_delete(bl->as_mob());
+ mob_delete(bl->is_mob());
}
static
@@ -2675,9 +2675,9 @@ void builtin_initnpctimer(ScriptState *st)
if (HARGO2(2))
nd_ = npc_name2id(stringish<NpcName>(ZString(conv_str(st, &AARGO2(2)))));
else
- nd_ = map_id_as_npc(st->oid);
+ nd_ = map_id_is_npc(st->oid);
assert (nd_ && nd_->npc_subtype == NpcSubtype::SCRIPT);
- dumb_ptr<npc_data_script> nd = nd_->as_script();
+ dumb_ptr<npc_data_script> nd = nd_->is_script();
npc_settimerevent_tick(nd, interval_t::zero());
npc_timerevent_start(nd);
@@ -2694,9 +2694,9 @@ void builtin_startnpctimer(ScriptState *st)
if (HARGO2(2))
nd_ = npc_name2id(stringish<NpcName>(ZString(conv_str(st, &AARGO2(2)))));
else
- nd_ = map_id_as_npc(st->oid);
+ nd_ = map_id_is_npc(st->oid);
assert (nd_ && nd_->npc_subtype == NpcSubtype::SCRIPT);
- dumb_ptr<npc_data_script> nd = nd_->as_script();
+ dumb_ptr<npc_data_script> nd = nd_->is_script();
npc_timerevent_start(nd);
}
@@ -2712,9 +2712,9 @@ void builtin_stopnpctimer(ScriptState *st)
if (HARGO2(2))
nd_ = npc_name2id(stringish<NpcName>(ZString(conv_str(st, &AARGO2(2)))));
else
- nd_ = map_id_as_npc(st->oid);
+ nd_ = map_id_is_npc(st->oid);
assert (nd_ && nd_->npc_subtype == NpcSubtype::SCRIPT);
- dumb_ptr<npc_data_script> nd = nd_->as_script();
+ dumb_ptr<npc_data_script> nd = nd_->is_script();
npc_timerevent_stop(nd);
}
@@ -2732,9 +2732,9 @@ void builtin_getnpctimer(ScriptState *st)
if (HARGO2(3))
nd_ = npc_name2id(stringish<NpcName>(ZString(conv_str(st, &AARGO2(3)))));
else
- nd_ = map_id_as_npc(st->oid);
+ nd_ = map_id_is_npc(st->oid);
assert (nd_ && nd_->npc_subtype == NpcSubtype::SCRIPT);
- dumb_ptr<npc_data_script> nd = nd_->as_script();
+ dumb_ptr<npc_data_script> nd = nd_->is_script();
switch (type)
{
@@ -2763,9 +2763,9 @@ void builtin_setnpctimer(ScriptState *st)
if (HARGO2(3))
nd_ = npc_name2id(stringish<NpcName>(ZString(conv_str(st, &AARGO2(3)))));
else
- nd_ = map_id_as_npc(st->oid);
+ nd_ = map_id_is_npc(st->oid);
assert (nd_ && nd_->npc_subtype == NpcSubtype::SCRIPT);
- dumb_ptr<npc_data_script> nd = nd_->as_script();
+ dumb_ptr<npc_data_script> nd = nd_->is_script();
npc_settimerevent_tick(nd, tick);
}
@@ -2875,7 +2875,7 @@ void builtin_getareausers_sub(dumb_ptr<block_list>, int *users)
static
void builtin_getareausers_living_sub(dumb_ptr<block_list> bl, int *users)
{
- if (!pc_isdead(bl->as_player()))
+ if (!pc_isdead(bl->is_player()))
(*users)++;
}
@@ -2915,7 +2915,7 @@ void builtin_getareausers(ScriptState *st)
static
void builtin_getareadropitem_sub(dumb_ptr<block_list> bl, int item, int *amount)
{
- dumb_ptr<flooritem_data> drop = bl->as_item();
+ dumb_ptr<flooritem_data> drop = bl->is_item();
if (drop->item_data.nameid == item)
(*amount) += drop->item_data.amount;
@@ -2925,7 +2925,7 @@ void builtin_getareadropitem_sub(dumb_ptr<block_list> bl, int item, int *amount)
static
void builtin_getareadropitem_sub_anddelete(dumb_ptr<block_list> bl, int item, int *amount)
{
- dumb_ptr<flooritem_data> drop = bl->as_item();
+ dumb_ptr<flooritem_data> drop = bl->is_item();
if (drop->item_data.nameid == item)
{
@@ -3467,7 +3467,7 @@ void builtin_cmdothernpc(ScriptState *st) // Added by RoVeRT
static
void builtin_mobcount_sub(dumb_ptr<block_list> bl, NpcEvent event, int *c)
{
- if (event == bl->as_mob()->npc_event)
+ if (event == bl->is_mob()->npc_event)
(*c)++;
}
@@ -3923,7 +3923,7 @@ void builtin_message(ScriptState *st)
static
void builtin_npctalk(ScriptState *st)
{
- dumb_ptr<npc_data> nd = map_id_as_npc(st->oid);
+ dumb_ptr<npc_data> nd = map_id_is_npc(st->oid);
dumb_string str = conv_str(st, &AARGO2(2));
if (nd)
@@ -4020,7 +4020,7 @@ void builtin_getsavepoint(ScriptState *st)
static
void builtin_areatimer_sub(dumb_ptr<block_list> bl, interval_t tick, NpcEvent event)
{
- pc_addeventtimer(bl->as_player(), tick, event);
+ pc_addeventtimer(bl->is_player(), tick, event);
}
static
diff --git a/src/map/skill-pools.cpp b/src/map/skill-pools.cpp
index 99d9abf..2774922 100644
--- a/src/map/skill-pools.cpp
+++ b/src/map/skill-pools.cpp
@@ -119,7 +119,7 @@ int skill_power(dumb_ptr<map_session_data> sd, SkillID skill_id)
int skill_power_bl(dumb_ptr<block_list> bl, SkillID skill)
{
if (bl->bl_type == BL::PC)
- return skill_power(bl->as_player(), skill);
+ return skill_power(bl->is_player(), skill);
else
return 0;
}
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index 46b8dda..ab5f55b 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -161,11 +161,11 @@ int skill_additional_effect(dumb_ptr<block_list> src, dumb_ptr<block_list> bl,
if (src->bl_type == BL::PC)
{
- sd = src->as_player();
+ sd = src->is_player();
}
else if (src->bl_type == BL::MOB)
{
- md = src->as_mob();
+ md = src->is_mob();
}
sc_def_phys_shield_spell = 0;
@@ -243,11 +243,11 @@ int skill_attack(BF attack_type, dumb_ptr<block_list> src,
return 0;
if (src->bl_prev == NULL || dsrc->bl_prev == NULL || bl->bl_prev == NULL) //prevよくわからない※
return 0;
- if (src->bl_type == BL::PC && pc_isdead(src->as_player())) //術者?がPCですでに死んでいたら何もしない
+ if (src->bl_type == BL::PC && pc_isdead(src->is_player())) //術者?がPCですでに死んでいたら何もしない
return 0;
- if (dsrc->bl_type == BL::PC && pc_isdead(dsrc->as_player())) //術者?がPCですでに死んでいたら何もしない
+ if (dsrc->bl_type == BL::PC && pc_isdead(dsrc->is_player())) //術者?がPCですでに死んでいたら何もしない
return 0;
- if (bl->bl_type == BL::PC && pc_isdead(bl->as_player())) //対象がPCですでに死んでいたら何もしない
+ if (bl->bl_type == BL::PC && pc_isdead(bl->is_player())) //対象がPCですでに死んでいたら何もしない
return 0;
//何もしない判定ここまで
@@ -282,14 +282,14 @@ int skill_attack(BF attack_type, dumb_ptr<block_list> src,
/* ダメージがあるなら追加効果判定 */
if (bl->bl_prev != NULL)
{
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
if (bl->bl_type != BL::PC || !pc_isdead(sd))
{
if (damage > 0)
skill_additional_effect(src, bl, skillid, skilllv);
if (bl->bl_type == BL::MOB && src != bl) /* スキル使用条件のMOBスキル */
{
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
if (battle_config.mob_changetarget_byskill == 1)
{
int target;
@@ -311,7 +311,7 @@ int skill_attack(BF attack_type, dumb_ptr<block_list> src,
&& src == dsrc
&& damage > 0)
{
- dumb_ptr<map_session_data> sd = src->as_player();
+ dumb_ptr<map_session_data> sd = src->is_player();
int hp = 0, sp = 0;
if (sd->hp_drain_rate && dmg.damage > 0
&& random_::chance({sd->hp_drain_rate, 100}))
@@ -383,13 +383,13 @@ int skill_castend_damage_id(dumb_ptr<block_list> src, dumb_ptr<block_list> bl,
nullpo_retr(1, bl);
if (src->bl_type == BL::PC)
- sd = src->as_player();
+ sd = src->is_player();
if (sd && pc_isdead(sd))
return 1;
if (bl->bl_prev == NULL)
return 1;
- if (bl->bl_type == BL::PC && pc_isdead(bl->as_player()))
+ if (bl->bl_type == BL::PC && pc_isdead(bl->is_player()))
return 1;
MapBlockLock lock;
@@ -406,7 +406,7 @@ int skill_castend_damage_id(dumb_ptr<block_list> src, dumb_ptr<block_list> bl,
/* 個別にダメージを与える */
if (src->bl_type == BL::MOB)
{
- dumb_ptr<mob_data> mb = src->as_mob();
+ dumb_ptr<mob_data> mb = src->is_mob();
mb->hp = skill_area_temp_hp;
if (bl->bl_id != skill_area_temp_id)
skill_attack(BF::MISC, src, src, bl,
@@ -417,7 +417,7 @@ int skill_castend_damage_id(dumb_ptr<block_list> src, dumb_ptr<block_list> bl,
}
else
{
- dumb_ptr<mob_data> md = src->as_mob();
+ dumb_ptr<mob_data> md = src->is_mob();
{
skill_area_temp_id = bl->bl_id;
skill_area_temp_hp = battle_get_hp(src);
@@ -482,9 +482,9 @@ int skill_castend_nodamage_id(dumb_ptr<block_list> src, dumb_ptr<block_list> bl,
nullpo_retr(1, bl);
if (src->bl_type == BL::PC)
- sd = src->as_player();
+ sd = src->is_player();
else if (src->bl_type == BL::MOB)
- md = src->as_mob();
+ md = src->is_mob();
sc_def_vit = 100 - (3 + battle_get_vit(bl) + battle_get_luk(bl) / 3);
sc_def_vit = 100 - (3 + battle_get_vit(bl) + battle_get_luk(bl) / 3);
@@ -493,11 +493,11 @@ int skill_castend_nodamage_id(dumb_ptr<block_list> src, dumb_ptr<block_list> bl,
if (bl->bl_type == BL::PC)
{
- dstsd = bl->as_player();
+ dstsd = bl->is_player();
}
else if (bl->bl_type == BL::MOB)
{
- dstmd = bl->as_mob();
+ dstmd = bl->is_mob();
if (sc_def_vit > 50)
sc_def_vit = 50;
if (sc_def_mdef > 50)
@@ -557,7 +557,7 @@ interval_t skill_castfix(dumb_ptr<block_list> bl, interval_t interval)
if (bl->bl_type == BL::MOB)
{ // Crash fix [Valaris]
- md = bl->as_mob();
+ md = bl->is_mob();
skill = md->skillid;
lv = md->skilllv;
}
@@ -629,7 +629,7 @@ int skill_castcancel(dumb_ptr<block_list> bl, int)
if (bl->bl_type == BL::PC)
{
- dumb_ptr<map_session_data> sd = bl->as_player();
+ dumb_ptr<map_session_data> sd = bl->is_player();
tick_t tick = gettick();
sd->canact_tick = tick;
sd->canmove_tick = tick;
@@ -638,7 +638,7 @@ int skill_castcancel(dumb_ptr<block_list> bl, int)
}
else if (bl->bl_type == BL::MOB)
{
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
if (md->skilltimer)
{
md->skilltimer.cancel();
@@ -773,7 +773,7 @@ void skill_status_change_end(dumb_ptr<block_list> bl, StatusChange type, TimerDa
clif_changeoption(bl);
if (bl->bl_type == BL::PC && calc_flag)
- pc_calcstatus(bl->as_player(), 0); /* ステータス再計算 */
+ pc_calcstatus(bl->is_player(), 0); /* ステータス再計算 */
}
int skill_update_heal_animation(dumb_ptr<map_session_data> sd)
@@ -781,10 +781,10 @@ int skill_update_heal_animation(dumb_ptr<map_session_data> sd)
const Opt2 mask = Opt2::_heal;
nullpo_ret(sd);
- bool was_active = bool(sd->opt2 & mask);
+ bool wis_active = bool(sd->opt2 & mask);
bool is_active = sd->quick_regeneration_hp.amount > 0;
- if (was_active == is_active)
+ if (wis_active == is_active)
return 0; // no update
if (is_active)
@@ -814,7 +814,7 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, int id, StatusChange
return;
if (bl->bl_type == BL::PC)
- sd = bl->as_player();
+ sd = bl->is_player();
//sc_count=battle_get_sc_count(bl); //使ってない?
@@ -844,11 +844,11 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, int id, StatusChange
if (bl->bl_type == BL::PC)
{
hp = 3 + hp * 3 / 200;
- pc_heal(bl->as_player(), -hp, 0);
+ pc_heal(bl->is_player(), -hp, 0);
}
else if (bl->bl_type == BL::MOB)
{
- dumb_ptr<mob_data> md = bl->as_mob();
+ dumb_ptr<mob_data> md = bl->is_mob();
hp = 3 + hp / 200;
md->hp -= hp;
}
@@ -940,7 +940,7 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type,
return 0;
if (bl->bl_type == BL::PC)
{
- sd = bl->as_player();
+ sd = bl->is_player();
}
else if (bl->bl_type == BL::MOB)
{