Skip to content

Commit

Permalink
Add bounds checking for statweap in dodamage. (#578)
Browse files Browse the repository at this point in the history
Fixes #523
  • Loading branch information
linewriter1024 authored and qreeves committed Sep 12, 2016
1 parent b525c57 commit 3aa209f
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions src/game/server.cpp
Expand Up @@ -4151,25 +4151,34 @@ namespace server
{
statalt = m->lastresalt[WR_BURN];
statweap = m->lastresweapon[WR_BURN];
if(statalt) v->weapstats[statweap].damage2 += realdamage;
else v->weapstats[statweap].damage1 += realdamage;
if(isweap(statweap))
{
if(statalt) v->weapstats[statweap].damage2 += realdamage;
else v->weapstats[statweap].damage1 += realdamage;
}
}
if(flags&HIT_BLEED)
{
statalt = m->lastresalt[WR_BLEED];
statweap = m->lastresweapon[WR_BLEED];
if(statalt) v->weapstats[statweap].damage2 += realdamage;
else v->weapstats[statweap].damage1 += realdamage;
if(isweap(statweap))
{
if(statalt) v->weapstats[statweap].damage2 += realdamage;
else v->weapstats[statweap].damage1 += realdamage;
}
}
if(flags&HIT_SHOCK)
{
statalt = m->lastresalt[WR_SHOCK];
statweap = m->lastresweapon[WR_SHOCK];
if(statalt) v->weapstats[statweap].damage2 += realdamage;
else v->weapstats[statweap].damage1 += realdamage;
if(isweap(statweap))
{
if(statalt) v->weapstats[statweap].damage2 += realdamage;
else v->weapstats[statweap].damage1 += realdamage;
}
}
}
else
else if(isweap(statweap))
{
if(statalt) v->weapstats[statweap].damage2 += realdamage;
else v->weapstats[statweap].damage1 += realdamage;
Expand Down Expand Up @@ -4197,7 +4206,7 @@ namespace server
m->lastresweapon[WR_SHOCK] = fromweap;
m->lastresalt[WR_SHOCK] = statalt;
}
if(isweap(weap) && m != v && (!m_team(gamemode, mutators) || m->team != v->team) && first)
if(isweap(statweap) && m != v && (!m_team(gamemode, mutators) || m->team != v->team) && first)
{
if(WK(flags))
{
Expand Down Expand Up @@ -4225,8 +4234,11 @@ namespace server
v->frags++;
v->totalfrags++;
v->localtotalfrags++;
if(statalt) v->weapstats[statweap].frags2++;
else v->weapstats[statweap].frags1++;
if(isweap(statweap))
{
if(statalt) v->weapstats[statweap].frags2++;
else v->weapstats[statweap].frags1++;
}
}
else fragvalue = -fragvalue;
bool isai = m->actortype >= A_ENEMY, isteamkill = false;
Expand Down

0 comments on commit 3aa209f

Please sign in to comment.