summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-11-04 22:41:51 -0800
committerBen Longbons <b.r.longbons@gmail.com>2014-11-04 22:41:53 -0800
commit9c19f89a5fb3947541286b349479eb8276dc8b65 (patch)
tree8e5c5654f48cbc8b3dd06a4b3d4d884eb4b808cd
parent0bc322efc087ab0c7b53709e5e20ac76aee761de (diff)
downloadtmwa-9c19f89a5fb3947541286b349479eb8276dc8b65.tar.gz
tmwa-9c19f89a5fb3947541286b349479eb8276dc8b65.tar.bz2
tmwa-9c19f89a5fb3947541286b349479eb8276dc8b65.tar.xz
tmwa-9c19f89a5fb3947541286b349479eb8276dc8b65.zip
Remove sc_count
It was a negligible performance gain during death, but a lot of bugs.
-rw-r--r--src/map/battle.cpp10
-rw-r--r--src/map/battle.hpp1
-rw-r--r--src/map/map.hpp2
-rw-r--r--src/map/mob.cpp1
-rw-r--r--src/map/pc.cpp2
-rw-r--r--src/map/skill.cpp20
6 files changed, 0 insertions, 36 deletions
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 63dc957..f852265 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -856,16 +856,6 @@ eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> battle_
return nullptr;
}
-short *battle_get_sc_count(dumb_ptr<block_list> bl)
-{
- nullpo_retr(nullptr, bl);
- if (bl->bl_type == BL::MOB)
- return &bl->is_mob()->sc_count;
- else if (bl->bl_type == BL::PC)
- return &bl->is_player()->sc_count;
- return nullptr;
-}
-
Opt1 *battle_get_opt1(dumb_ptr<block_list> bl)
{
nullpo_retn(bl);
diff --git a/src/map/battle.hpp b/src/map/battle.hpp
index 4a69b8e..aa96a72 100644
--- a/src/map/battle.hpp
+++ b/src/map/battle.hpp
@@ -97,7 +97,6 @@ MobMode battle_get_mode(dumb_ptr<block_list> bl);
int battle_get_stat(SP stat_id, dumb_ptr<block_list> bl);
eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> battle_get_sc_data(dumb_ptr<block_list> bl);
-short *battle_get_sc_count(dumb_ptr<block_list> bl);
Opt1 *battle_get_opt1(dumb_ptr<block_list> bl);
Opt2 *battle_get_opt2(dumb_ptr<block_list> bl);
Opt3 *battle_get_opt3(dumb_ptr<block_list> bl);
diff --git a/src/map/map.hpp b/src/map/map.hpp
index f82283d..14ea6a7 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -261,7 +261,6 @@ struct map_session_data : block_list, SessionData
Map<SIR, RString> regstrm;
earray<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data;
- short sc_count;
AccountId trade_partner;
Array<IOff2, TRADE_MAX> deal_item_index;
@@ -453,7 +452,6 @@ struct mob_data : block_list
std::vector<Item> lootitemv;
earray<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data;
- short sc_count;
Opt1 opt1;
Opt2 opt2;
Opt3 opt3;
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index cab17a0..044d0b6 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -1178,7 +1178,6 @@ int mob_spawn(BlockId id)
assert (!md->sc_data[i].timer);
md->sc_data[i].val1 = 0;
}
- md->sc_count = 0;
md->opt1 = Opt1::ZERO;
md->opt2 = Opt2::ZERO;
md->opt3 = Opt3::ZERO;
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 70c9087..95bdb8d 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -684,7 +684,6 @@ int pc_authok(AccountId id, int login_id2, TimeT connect_until_time,
// sd->sc_data[i].timer = nullptr;
sd->sc_data[i].val1 = 0;
}
- sd->sc_count = 0;
// パーティー関係の初期化
sd->party_sended = 0;
@@ -1284,7 +1283,6 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
}
// スキルやステータス異常による残りのパラメータ補正
- if (sd->sc_count)
{
// ATK/DEF変化形
if (sd->sc_data[StatusChange::SC_POISON].timer) // 毒状態
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index 9889772..4d70770 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -702,7 +702,6 @@ void skill_status_change_end(dumb_ptr<block_list> bl, StatusChange type, TimerDa
{
eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data;
int opt_flag = 0, calc_flag = 0;
- short *sc_count;
Opt0 *option;
Opt1 *opt1;
Opt2 *opt2;
@@ -718,8 +717,6 @@ void skill_status_change_end(dumb_ptr<block_list> bl, StatusChange type, TimerDa
sc_data = battle_get_sc_data(bl);
if (not sc_data)
return;
- sc_count = battle_get_sc_count(bl);
- nullpo_retv(sc_count);
option = battle_get_option(bl);
nullpo_retv(option);
opt1 = battle_get_opt1(bl);
@@ -743,8 +740,6 @@ void skill_status_change_end(dumb_ptr<block_list> bl, StatusChange type, TimerDa
// whether we are the timer or a cancel no longer matters
assert (!sc_data[type].timer);
- assert ((*sc_count) > 0);
- (*sc_count)--;
switch (type)
{ /* 異常の種類ごとの処理 */
@@ -825,7 +820,6 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, BlockId id, StatusCh
dumb_ptr<block_list> bl;
dumb_ptr<map_session_data> sd = nullptr;
eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data;
- //short *sc_count; //使ってない?
if ((bl = map_id2bl(id)) == nullptr)
return;
@@ -837,8 +831,6 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, BlockId id, StatusCh
if (bl->bl_type == BL::PC)
sd = bl->is_player();
- //sc_count=battle_get_sc_count(bl); //使ってない?
-
if (sc_data[type].spell_invocation)
{ // Must report termination
magic::spell_effect_report_termination(sc_data[type].spell_invocation,
@@ -926,7 +918,6 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type,
{
dumb_ptr<map_session_data> sd = nullptr;
eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data;
- short *sc_count;
Opt0 *option;
Opt1 *opt1;
Opt2 *opt2;
@@ -939,8 +930,6 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type,
sc_data = battle_get_sc_data(bl);
if (not sc_data)
return 0;
- sc_count = battle_get_sc_count(bl);
- nullpo_retz(sc_count);
option = battle_get_option(bl);
nullpo_retz(option);
opt1 = battle_get_opt1(bl);
@@ -984,7 +973,6 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type,
/* 継ぎ足しができない状態異常である時は状態異常を行わない */
{
- (*sc_count)--;
sc_data[type].timer.cancel();
}
}
@@ -1070,8 +1058,6 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type,
if (opt_flag) /* optionの変更 */
clif_changeoption(bl);
- (*sc_count)++; /* ステータス異常の数 */
-
sc_data[type].val1 = val1;
if (sc_data[type].spell_invocation) // Supplant by newer spell
magic::spell_effect_report_termination(sc_data[type].spell_invocation,
@@ -1100,7 +1086,6 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type,
int skill_status_change_clear(dumb_ptr<block_list> bl, int type)
{
eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data;
- short *sc_count;
Opt0 *option;
Opt1 *opt1;
Opt2 *opt2;
@@ -1110,8 +1095,6 @@ int skill_status_change_clear(dumb_ptr<block_list> bl, int type)
sc_data = battle_get_sc_data(bl);
if (not sc_data)
return 0;
- sc_count = battle_get_sc_count(bl);
- nullpo_retz(sc_count);
option = battle_get_option(bl);
nullpo_retz(option);
opt1 = battle_get_opt1(bl);
@@ -1121,14 +1104,11 @@ int skill_status_change_clear(dumb_ptr<block_list> bl, int type)
opt3 = battle_get_opt3(bl);
nullpo_retz(opt3);
- if (*sc_count == 0)
- return 0;
for (StatusChange i : erange(StatusChange(), StatusChange::MAX_STATUSCHANGE))
{
if (sc_data[i].timer)
skill_status_change_end(bl, i, nullptr);
}
- *sc_count = 0;
*opt1 = Opt1::ZERO;
*opt2 = Opt2::ZERO;
*opt3 = Opt3::ZERO;