From 7f2a6be58f6c100a8784e5cbca884108160c0f48 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 30 Sep 2013 14:49:53 -0700 Subject: Fix bug in drop order assignment Originally, there was a bug that incorrectly assigned second and third. But when I fixed that I introduced this bug that incorrectly assigned all. --- src/map/mob.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/map/mob.cpp b/src/map/mob.cpp index 97fb760..f8edff9 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -2475,21 +2475,39 @@ int mob_damage(dumb_ptr src, dumb_ptr md, int damage, }; std::vector ptv; + int mvp_dmg = 0, second_dmg = 0, third_dmg = 0; for (mob_data::DmgLogEntry& dle : md->dmglogv) { dumb_ptr tmpsdi = map_id2sd(dle.id); + int tmpdmg = dle.dmg; if (tmpsdi == NULL) continue; if (tmpsdi->bl_m != md->bl_m || pc_isdead(tmpsdi)) continue; // this way is actually fair, unlike the old way - if (!mvp_sd) + // that refers to the subsequents ... was buggy though + if (tmpdmg > mvp_dmg) + { + third_sd = second_sd; + third_dmg = second_dmg; + second_sd = mvp_sd; + second_dmg = mvp_dmg; mvp_sd = tmpsdi; - else if (!second_sd) + mvp_dmg = tmpdmg; + } + else if (tmpdmg > second_dmg) + { + third_sd = second_sd; + third_dmg = second_dmg; second_sd = tmpsdi; - else if (!third_sd) + second_dmg = tmpdmg; + } + else if (tmpdmg > third_dmg) + { third_sd = tmpsdi; + third_dmg = tmpdmg; + } int base_exp, job_exp, flag = 1; double per; -- cgit v1.2.3-60-g2f50