# HG changeset patch # User Adam Kaminski # Date 1610471909 18000 # Tue Jan 12 12:18:29 2021 -0500 # Node ID a73c3724bcd2374968a4c3c15fdbfa641ca53ea3 # Parent 42b7db4bc8b2d4612df7ca8845333cc260343b8f Fixed a crash that occurred in the player menu if a derived class was missing the skins of its parent class because it wasn't on the list of available player classes. diff -r 42b7db4bc8b2 -r a73c3724bcd2 src/r_data/sprites.cpp --- a/src/r_data/sprites.cpp Sun Jan 10 22:26:11 2021 +0100 +++ b/src/r_data/sprites.cpp Tue Jan 12 12:18:29 2021 -0500 @@ -698,15 +698,36 @@ } else if (0 == stricmp (key, "class")) { // [GRB] Define the skin for a specific player class - int pclass = D_PlayerClassToInt (sc.String); + // [AK] Store the display name into a string, we might need it later. + const char *displayname = sc.String; + int pclass = D_PlayerClassToInt (displayname); if (pclass < 0) { remove = true; - break; + + // [AK] Check the player class list, and see if they're descendents of + // a class using this display name. This is important, since these classes must + // must still inherit all their parent's skins. Otherwise, bad things may happen. + for (j = 0; j < (int)PlayerClasses.Size(); j++) + { + PClass *parent = PlayerClasses[j].Type->ParentClass; + if (stricmp (parent->Meta.GetMetaString(APMETA_DisplayName), displayname) == 0) + { + basetype = transtype = parent; + remove = false; + break; + } + } + + if (remove) + break; } - - basetype = transtype = PlayerClasses[pclass].Type; + // [AK] Only execute this block if the class was on the list. + else + { + basetype = transtype = PlayerClasses[pclass].Type; + } } // [BL] Skulltag additions else if (0 == stricmp (key, "hidden"))