sprintf( buf, "%s", get_char_world( ch, roster->name ) == NULL ? "offline" : "online" );
sprintf( buf, "%s", IS_NPC(ch) ? "" : (get_char_world( ch, roster->name ) == NULL ? "offline" : "online" ) );
sprintf( buf, "%s",
IS_NPC(ch)
? ""
: (get_char_world( ch, roster->name ) == NULL
? "offline"
: "online" ) );
#include <stdio.h>
int main()
{ unsigned char yes = 1;
unsigned char no = 0;
printf("%s\n", (yes && !no) ? "Online" : "Offline");
no = 1;
printf("%s\n", (yes && !no) ? "Online" : "Offline");
return 1;
}
sprintf( buf, "%s", (!IS_NPC(ch) && get_char_world( ch, roster->name ) == NULL) ? "offline" : "online" );
It's Smaug. See the problem? I need a !IS_NPC check there. Can C do 'and' logic with inline logic checks?