- Duke: Clean up player/actor accesses in haslock().

This commit is contained in:
Mitchell Richters 2023-10-03 22:57:20 +11:00
parent 31a43cdd79
commit f80290d80e
3 changed files with 4 additions and 5 deletions

View file

@ -119,7 +119,7 @@ void checkweapons(DDukePlayer* const p);
int findotherplayer(int p, double* d); int findotherplayer(int p, double* d);
void quickkill(DDukePlayer* p); void quickkill(DDukePlayer* p);
int setpal(DDukePlayer* p); int setpal(DDukePlayer* p);
int haslock(sectortype* sect, int snum); int haslock(sectortype* sect, DDukePlayer* const p);
void purplelavacheck(DDukePlayer* p); void purplelavacheck(DDukePlayer* p);
void addphealth(DDukePlayer* p, int amount, bool bigitem); void addphealth(DDukePlayer* p, int amount, bool bigitem);
int playereat(DDukePlayer* p, int amount, bool bigitem); int playereat(DDukePlayer* p, int amount, bool bigitem);

View file

@ -999,9 +999,8 @@ bool movementBlocked(DDukePlayer *p)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int haslock(sectortype* sectp, int snum) int haslock(sectortype* sectp, DDukePlayer* const p)
{ {
auto p = getPlayer(snum);
if (!sectp) if (!sectp)
return 0; return 0;
if (!sectp->lockinfo) if (!sectp->lockinfo)

View file

@ -368,7 +368,7 @@ void checksectors_r(int snum)
if (isactivator(act) || ismasterswitch(act)) if (isactivator(act) || ismasterswitch(act))
return; return;
} }
if (haslock(near.hitSector, snum)) if (haslock(near.hitSector, p))
operatesectors(near.hitSector, p->GetActor()); operatesectors(near.hitSector, p->GetActor());
else else
{ {
@ -389,7 +389,7 @@ void checksectors_r(int snum)
if (isactivator(act) || ismasterswitch(act)) if (isactivator(act) || ismasterswitch(act))
return; return;
} }
if (haslock(near.hitSector, snum)) if (haslock(near.hitSector, p))
operatesectors(p->GetActor()->sector(), p->GetActor()); operatesectors(p->GetActor()->sector(), p->GetActor());
else else
{ {