Browse Source

Remove mi argument from DeleteMissile

This value is always the current value of ActiveMissiles[i], while the caller has retrieved the index for its own use it's easier to track what the function does by just passing i.
pull/2820/head
ephphatha 5 years ago committed by Anders Jenbo
parent
commit
851fb87e24
  1. 6
      Source/missiles.cpp
  2. 2
      Source/missiles.h
  3. 2
      Source/portal.cpp

6
Source/missiles.cpp

@ -954,9 +954,9 @@ Direction16 GetDirection16(Point p1, Point p2)
return ret;
}
void DeleteMissile(int mi, int i)
void DeleteMissile(int i)
{
AvailableMissiles[MAXMISSILES - ActiveMissileCount] = mi;
AvailableMissiles[MAXMISSILES - ActiveMissileCount] = ActiveMissiles[i];
ActiveMissileCount--;
if (ActiveMissileCount > 0 && i != ActiveMissileCount)
ActiveMissiles[i] = ActiveMissiles[ActiveMissileCount];
@ -4277,7 +4277,7 @@ static void DeleteMissiles()
{
for (int i = 0; i < ActiveMissileCount;) {
if (Missiles[ActiveMissiles[i]]._miDelFlag) {
DeleteMissile(ActiveMissiles[i], i);
DeleteMissile(i);
} else {
i++;
}

2
Source/missiles.h

@ -135,7 +135,7 @@ extern bool MissilePreFlag;
void GetDamageAmt(int i, int *mind, int *maxd);
int GetSpellLevel(int playerId, spell_id sn);
Direction16 GetDirection16(Point p1, Point p2);
void DeleteMissile(int mi, int i);
void DeleteMissile(int i);
bool MonsterTrapHit(int m, int mindam, int maxdam, int dist, missile_id t, bool shift);
bool PlayerMHit(int pnum, Monster *monster, int dist, int mind, int maxd, missile_id mtype, bool shift, int earflag, bool *blocked);
void SetMissDir(Missile &missile, int dir);

2
Source/portal.cpp

@ -120,7 +120,7 @@ void RemovePortalMissile(int id)
if (Portals[id].level != 0)
AddUnLight(missile._mlid);
DeleteMissile(mi, i);
DeleteMissile(i);
}
}
}

Loading…
Cancel
Save