Skip attemting to strip author name from level name if already defined.

This commit is contained in:
Mari the Deer 2023-11-19 22:44:32 +01:00
commit 07ad8fd41b
3 changed files with 25 additions and 19 deletions

View file

@ -794,9 +794,12 @@ extend Class SWWMStatusBar
if ( ln.Left(1) == "$" ) ln = StringTable.Localize(ln);
// level name may contain trailing whitespace due to DEHACKED nonsense, so strip it
ln.StripRight();
int iof;
if ( ((iof = ln.RightIndexOf(" - by: ")) != -1) || ((iof = ln.RightIndexOf(" - by ")) != -1) || ((iof = ln.RightIndexOf(" - ")) != -1) )
ln.Truncate(iof);
if ( level.authorname == "" ) // the author name might be part of the level name, try to strip it
{
int iof;
if ( ((iof = ln.RightIndexOf(" - by: ")) != -1) || ((iof = ln.RightIndexOf(" - by ")) != -1) || ((iof = ln.RightIndexOf(" - ")) != -1) )
ln.Truncate(iof);
}
// split level name into separate lines if it's too long
// also, use a cache so we don't call BreakLines constantly
if ( ln_bl && (ln != cached_ln) ) ln_bl.Destroy();

View file

@ -806,21 +806,24 @@ Class DSMapTitle : HUDMessageBase
SWWMUtility.StripColor(txtsub);
// level name may contain trailing whitespace due to DEHACKED nonsense, so strip it
txt.StripRight();
int sep;
if ( (sep = txt.RightIndexOf(" - by: ")) != -1 ) // 20 heretics, spooktober
if ( txtsub == "" ) // if we already have an author name, don't do this stuff
{
txtsub = txt.Mid(sep+7);
txt.Truncate(sep);
}
else if ( (sep = txt.RightIndexOf(" - by ")) != -1 ) // variation seen in DOOMIUM
{
txtsub = txt.Mid(sep+6);
txt.Truncate(sep);
}
else if ( (sep = txt.RightIndexOf(" - ")) != -1 ) // hexmas and many others (may cause false positives?)
{
txtsub = txt.Mid(sep+3);
txt.Truncate(sep);
int sep;
if ( (sep = txt.RightIndexOf(" - by: ")) != -1 ) // 20 heretics, spooktober
{
txtsub = txt.Mid(sep+7);
txt.Truncate(sep);
}
else if ( (sep = txt.RightIndexOf(" - by ")) != -1 ) // variation seen in DOOMIUM
{
txtsub = txt.Mid(sep+6);
txt.Truncate(sep);
}
else if ( (sep = txt.RightIndexOf(" - ")) != -1 ) // hexmas and many others (may cause false positives?)
{
txtsub = txt.Mid(sep+3);
txt.Truncate(sep);
}
}
hasnewline = (txt.IndexOf("\n") != -1);
bTxtIsSplit = false;