Change handling of explicitly blank briefings

Prior versions of Descent had a bug that specifying `briefing=` did not
inhibit a briefing.  Instead the directive was completely ignored.  The
engine would then use the auto-detected briefing if one was found.  This
quirk was eliminated during refactoring of the mission parsing code.
Unfortunately, some published missions relied on this bug: they ship a
briefing, but their mission file explicitly states that there is no
briefing.  Players expect the briefing to play despite the mission
stating that there is none.

Reorder the logic to restore the bug that `briefing=` is ignored.

Reported-by: Calmarius <https://forum.dxx-rebirth.com/showthread.php?tid=1054>
Fixes: 6020c9c013 ("Use d_fname for DOS filenames")
This commit is contained in:
Kp 2018-06-13 02:02:58 +00:00
parent 5526de4c10
commit 8690bf4ca7

View file

@ -716,11 +716,14 @@ static void set_briefing_filename(d_fname &f, const char *const v)
static void record_briefing(d_fname &f, array<char, PATH_MAX> &buf)
{
const auto v = get_value(buf.data());
std::size_t d;
if (v && (d = std::distance(v, std::find_if(v, buf.end(), null_or_space))))
if (!v)
return;
const std::size_t d = std::distance(v, std::find_if(v, buf.end(), null_or_space));
if (d >= FILENAME_LEN)
return;
{
set_briefing_filename(f, v, std::min(d, f.size() - sizeof(tex)));
else
f = {};
}
}
#undef tex