From 9c19f89a5fb3947541286b349479eb8276dc8b65 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 4 Nov 2014 22:41:51 -0800 Subject: Remove sc_count It was a negligible performance gain during death, but a lot of bugs. --- src/map/battle.cpp | 10 ---------- src/map/battle.hpp | 1 - src/map/map.hpp | 2 -- src/map/mob.cpp | 1 - src/map/pc.cpp | 2 -- src/map/skill.cpp | 20 -------------------- 6 files changed, 36 deletions(-) (limited to 'src') 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 battle_ return nullptr; } -short *battle_get_sc_count(dumb_ptr 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 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 bl); int battle_get_stat(SP stat_id, dumb_ptr bl); eptr battle_get_sc_data(dumb_ptr bl); -short *battle_get_sc_count(dumb_ptr bl); Opt1 *battle_get_opt1(dumb_ptr bl); Opt2 *battle_get_opt2(dumb_ptr bl); Opt3 *battle_get_opt3(dumb_ptr 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 regstrm; earray sc_data; - short sc_count; AccountId trade_partner; Array deal_item_index; @@ -453,7 +452,6 @@ struct mob_data : block_list std::vector lootitemv; earray 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 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 bl, StatusChange type, TimerDa { eptr 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 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 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 bl; dumb_ptr sd = nullptr; eptr 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 bl, StatusChange type, { dumb_ptr sd = nullptr; eptr sc_data; - short *sc_count; Opt0 *option; Opt1 *opt1; Opt2 *opt2; @@ -939,8 +930,6 @@ int skill_status_effect(dumb_ptr 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 bl, StatusChange type, /* 継ぎ足しができない状態異常である時は状態異常を行わない */ { - (*sc_count)--; sc_data[type].timer.cancel(); } } @@ -1070,8 +1058,6 @@ int skill_status_effect(dumb_ptr 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 bl, StatusChange type, int skill_status_change_clear(dumb_ptr bl, int type) { eptr sc_data; - short *sc_count; Opt0 *option; Opt1 *opt1; Opt2 *opt2; @@ -1110,8 +1095,6 @@ int skill_status_change_clear(dumb_ptr 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 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; -- cgit v1.2.3-60-g2f50