fix saddle sanity check code

Fix some bad code for "no saddle" caused by careless editing that
changed (uncomitted)
  char *ns = 0;
  if (foo)
    ns = "foo";
  else if (bar)
    ns = "bar";
by splicing lines together and accidentally ended up with
  char *ns;
  ns = foo ? ns = "foo" : bar ? ns = "bar" : 0;
when
  char *ns;
  ns = foo ? "foo" : bar ? "bar" : 0;
was intended.

I'm a bit surprised that the intermediate form without any
parentheses around 'ns = "bar"' compiles at all.  C99?  I don't
think that it would have if it had been processed as C90 or pre-ANSI.
This commit is contained in:
PatR
2021-05-11 15:59:19 -07:00
parent 708a169917
commit 25b1baed84

View File

@@ -111,8 +111,8 @@ sanity_check_single_mon(
if (mtmp == u.usteed) {
const char *ns, *nt = !mtmp->mtame ? "not tame" : 0;
ns = !m_carrying(mtmp, SADDLE) ? ns = "no saddle"
: !which_armor(mtmp, W_SADDLE) ? ns = "saddle not worn"
ns = !m_carrying(mtmp, SADDLE) ? "no saddle"
: !which_armor(mtmp, W_SADDLE) ? "saddle not worn"
: 0;
if (ns || nt)
impossible("steed: %s%s%s (%s)",