summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-09-30 14:49:53 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-09-30 15:22:27 -0700
commit7f2a6be58f6c100a8784e5cbca884108160c0f48 (patch)
tree0fdadeb718aaa4e04d20eecc22e221c4f9a5cdbe
parent49e5c4af12a9b276a72a9d04033d86a1c4d68601 (diff)
downloadtmwa-7f2a6be58f6c100a8784e5cbca884108160c0f48.tar.gz
tmwa-7f2a6be58f6c100a8784e5cbca884108160c0f48.tar.bz2
tmwa-7f2a6be58f6c100a8784e5cbca884108160c0f48.tar.xz
tmwa-7f2a6be58f6c100a8784e5cbca884108160c0f48.zip
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.
-rw-r--r--src/map/mob.cpp24
1 files 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<block_list> src, dumb_ptr<mob_data> md, int damage,
};
std::vector<DmgLogParty> ptv;
+ int mvp_dmg = 0, second_dmg = 0, third_dmg = 0;
for (mob_data::DmgLogEntry& dle : md->dmglogv)
{
dumb_ptr<map_session_data> 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;