Small refactor

This commit is contained in:
Leonard2 2016-05-26 21:58:46 +02:00
parent b220db4ebe
commit 8f360f3bea
3 changed files with 31 additions and 31 deletions

View file

@ -531,8 +531,8 @@ public:
// PSprite layers
void TickPSprites();
void DestroyPSprites();
DPSprite *GetPSprite(psprnum_t layer); // Used ONLY for compatibility with the old hardcoded layers.
DPSprite *FindPSprite(int layer);
DPSprite *GetPSprite(psprnum_t layer); // Used ONLY for compatibility with the old hardcoded layers.
};
// Bookkeeping on players - state.

View file

@ -128,7 +128,7 @@ DPSprite::DPSprite(player_t *owner, AInventory *caller, int id)
}
Next = next;
GC::WriteBarrier(this, next);
if (prev == NULL)
if (prev == nullptr)
{
Owner->psprites = this;
GC::WriteBarrier(this);
@ -149,6 +149,29 @@ DPSprite::DPSprite(player_t *owner, AInventory *caller, int id)
//
//------------------------------------------------------------------------
DPSprite *player_t::FindPSprite(int layer)
{
if (layer == 0)
return nullptr;
DPSprite *pspr = psprites;
while (pspr)
{
if (pspr->ID == layer)
break;
pspr = pspr->Next;
}
return pspr;
}
//------------------------------------------------------------------------
//
//
//
//------------------------------------------------------------------------
DPSprite *player_t::GetPSprite(psprnum_t layer)
{
assert(layer > 0 && layer < NUMPSPRITES);
@ -177,29 +200,6 @@ DPSprite *player_t::GetPSprite(psprnum_t layer)
return pspr;
}
//------------------------------------------------------------------------
//
//
//
//------------------------------------------------------------------------
DPSprite *player_t::FindPSprite(int layer)
{
if (layer == 0)
return nullptr;
DPSprite *pspr = psprites;
while (pspr)
{
if (pspr->ID == layer)
break;
pspr = pspr->Next;
}
return pspr;
}
//---------------------------------------------------------------------------
//
// PROC P_NewPspriteTick

View file

@ -62,12 +62,12 @@ public:
static void NewTick();
void SetState(FState *newstate, bool pending = false);
int GetID() const { return ID; }
int GetSprite() const { return Sprite; }
int GetFrame() const { return Frame; }
FState* GetState() const { return State; }
DPSprite* GetNext() { return Next; }
AInventory* GetCaller() { return Caller; }
int GetID() const { return ID; }
int GetSprite() const { return Sprite; }
int GetFrame() const { return Frame; }
FState* GetState() const { return State; }
DPSprite* GetNext() { return Next; }
AInventory* GetCaller() { return Caller; }
double x, y;
double oldx, oldy;