- treat PSP layer ID 0 as invalid

No PSprites with this ID may ever be created, as there is no means to find them again.
This commit is contained in:
Christoph Oelckers 2022-04-12 00:17:25 +02:00
parent f3d557bcf5
commit bc566fac4e
2 changed files with 2 additions and 1 deletions

View File

@ -316,7 +316,7 @@ DPSprite *player_t::GetPSprite(PSPLayers layer)
newcaller = ReadyWeapon;
}
if (newcaller == nullptr) return nullptr; // Error case was not handled properly. This function cannot give a guarantee to always succeed!
if (newcaller == nullptr || layer == PSP_CALLERID) return nullptr; // Error case was not handled properly. This function cannot give a guarantee to always succeed!
DPSprite *pspr = FindPSprite(layer);
if (pspr == nullptr)

View File

@ -51,6 +51,7 @@ class player_t;
enum PSPLayers
{
PSP_STRIFEHANDS = -1,
PSP_CALLERID = 0,
PSP_WEAPON = 1,
PSP_FLASH = 1000,
PSP_TARGETCENTER = INT_MAX - 2,