This is a similar function to mprog_seval and mprog_veval but it will evaulate a boolean. Stock smaug had originally just evaluated ifchecks for a given circumstance and just returned without being able to use an operator and a value, value being true or false. To overcome this builders would have to create an ELSE clause, and not every ifcheck did something in an ELSE situation

For example:
 if isfight($n)
  break
 else
  if rand(10)
   yawn
  endif
 endif

The following function will allow you to do something shorter like so:
 if isfight($n) == false
  if rand(10)
   yawn
  endif
 endif

[code]
// Boolean Evaluation
bool mprog_beval( bool lhs, char *opr, char *rhs, CHAR_DATA *mob )
{
  char log_buf[MAX_STRING_LENGTH];
  bool rval;

  if ( rhs[0] == '\0' )
    return lhs;
  else if ( !str_cmp( rhs, "true" ) )
    rval = TRUE;
  else if ( !str_cmp( rhs, "false" ) )
    rval = FALSE;
  else
    return lhs;

  if ( opr[0] == '\0' )
    return lhs;
  if ( !str_cmp( opr, "==" ) )
    return ( bool )( lhs == rval );
  if ( !str_cmp( opr, "!=" ) )
    return ( bool )( lhs != rval );

  sprintf( log_buf, "Improper MOBprog operator '%s' for Boolean Evaluation", opr );
  progbug( log_buf, mob );
  return lhs;
}
[/code]

Now in mud_prog.c for the ifchecks you will change to the following, I will show you isfight as the example:
Original Code:
[code]
        if ( !str_cmp(chck, "isfight") )
        {
            return who_fighting(chkchar) ? TRUE : FALSE;
        }
[/code]

This now becomes:
[code]
        if ( !str_cmp(chck, "isfight") )
        {
            return mprog_beval( (who_fighting(chkchar) != NULL), opr, rval, mob );
        }
[/code]