summaryrefslogtreecommitdiff
path: root/src/map/skill.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-04-02 17:03:32 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-04-02 17:03:32 -0700
commita1c64eebe013bc5b7df72cce44aa85d66ead38e2 (patch)
tree1365911f49e2c87bcfcb5b2525f1c00a983ded26 /src/map/skill.cpp
parent331af48d176bbc0f9a15bc0620eceec903af6eb9 (diff)
downloadtmwa-a1c64eebe013bc5b7df72cce44aa85d66ead38e2.tar.gz
tmwa-a1c64eebe013bc5b7df72cce44aa85d66ead38e2.tar.bz2
tmwa-a1c64eebe013bc5b7df72cce44aa85d66ead38e2.tar.xz
tmwa-a1c64eebe013bc5b7df72cce44aa85d66ead38e2.zip
Fail sooner when the impossible things happen
Diffstat (limited to 'src/map/skill.cpp')
-rw-r--r--src/map/skill.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index 8a2deb2..4375541 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -761,7 +761,7 @@ int skill_status_change_active(struct block_list *bl, StatusChange type)
return sc_data[type].timer != nullptr;
}
-int skill_status_change_end(struct block_list *bl, StatusChange type, TimerData *tid)
+void skill_status_change_end(struct block_list *bl, StatusChange type, TimerData *tid)
{
eptr<struct status_change, StatusChange> sc_data;
int opt_flag = 0, calc_flag = 0;
@@ -771,29 +771,32 @@ int skill_status_change_end(struct block_list *bl, StatusChange type, TimerData
Opt2 *opt2;
Opt3 *opt3;
- nullpo_ret(bl);
+ nullpo_retv(bl);
if (bl->type != BL::PC && bl->type != BL::MOB)
{
if (battle_config.error_log)
PRINTF("skill_status_change_end: neither MOB nor PC !\n");
- return 0;
+ return;
}
sc_data = battle_get_sc_data(bl);
if (not sc_data)
- return 0;
+ return;
sc_count = battle_get_sc_count(bl);
- nullpo_ret(sc_count);
+ nullpo_retv(sc_count);
option = battle_get_option(bl);
- nullpo_ret(option);
+ nullpo_retv(option);
opt1 = battle_get_opt1(bl);
- nullpo_ret(opt1);
+ nullpo_retv(opt1);
opt2 = battle_get_opt2(bl);
- nullpo_ret(opt2);
+ nullpo_retv(opt2);
opt3 = battle_get_opt3(bl);
- nullpo_ret(opt3);
+ nullpo_retv(opt3);
+
+ if (!sc_data[type].timer)
+ return;
+ assert ((*sc_count) > 0);
+ assert (sc_data[type].timer == tid || !tid);
- if ((*sc_count) > 0 && sc_data[type].timer
- && (sc_data[type].timer == tid || !tid))
{
if (!tid)
@@ -854,8 +857,6 @@ int skill_status_change_end(struct block_list *bl, StatusChange type, TimerData
if (bl->type == BL::PC && calc_flag)
pc_calcstatus((struct map_session_data *) bl, 0); /* ステータス再計算 */
}
-
- return 0;
}
int skill_update_heal_animation(struct map_session_data *sd)