mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
APROP_SoundClass inits a default value and checks for null pointers
- Gave default init value to SoundClass as "Player" - Changed SoundClass detection to use the if/else structure - Checked for null pointer in S_FindSkinnedSound when reading the player's sound class
This commit is contained in:
parent
852a96497d
commit
f6bdbfe535
2 changed files with 7 additions and 3 deletions
|
@ -391,7 +391,7 @@ public:
|
|||
float BlendB = 0;
|
||||
float BlendA = 0;
|
||||
|
||||
FString SoundClass;
|
||||
FString SoundClass = "Player";
|
||||
FString LogText; // [RH] Log for Strife
|
||||
FString SubtitleText;
|
||||
int SubtitleCounter;
|
||||
|
|
|
@ -1620,7 +1620,11 @@ static const char *GetSoundClass(AActor *pp)
|
|||
}
|
||||
auto sclass = player? pp->NameVar(NAME_SoundClass) : NAME_None;
|
||||
|
||||
sclass != NAME_None ? pp->player->SoundClass = sclass.GetChars() : (FString)"player";
|
||||
if (sclass != NAME_None)
|
||||
pp->player->SoundClass = sclass.GetChars();
|
||||
else
|
||||
pp->player->SoundClass = "Player";
|
||||
|
||||
return sclass != NAME_None ? sclass.GetChars() : "player";
|
||||
}
|
||||
|
||||
|
@ -1638,7 +1642,7 @@ int S_FindSkinnedSound (AActor *actor, FSoundID refid)
|
|||
|
||||
if (actor != nullptr)
|
||||
{
|
||||
pclass = actor->player->SoundClass;
|
||||
if (actor->player != nullptr) pclass = actor->player->SoundClass;
|
||||
if (actor->player != nullptr) gender = actor->player->userinfo.GetGender();
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue