Weird Compiler Error

Posted by Terry on Sun 01 Apr 2007 01:56 PM — 2 posts, 12,277 views.

USA #0
In SW:FotE FUSS, as one of my team pointed out jokingly, when you type 'mfind god', you are returned with "Nothing like that in hell, earth, or heaven." To ammend this, I added the following snippet to act_wiz.c:

void do_mfind( CHAR_DATA * ch, char *argument )
{
   char arg[MAX_INPUT_LENGTH];
   MOB_INDEX_DATA *pMobIndex;
   int hash;
   int nMatch;
   bool fAll;

   one_argument( argument, arg );
   if( arg[3] == '\0' && !"God" && !"god" )
   {
      send_to_char( "Mfind whom?\r\n", ch );
      return;
   }
   else if( arg[3] == "God" || "god" )
   {
      send_to_char( "Of course he exists! But why should he \ bother showing his face to a mere inquisitive mortal such \ as yourself?\r\n", ch );
      return;
   }


I couldn't find anything wrong with this snippet. However, when I went to compile it, I got the following error:

act_wiz.c: In function `do_mfind':
act_wiz.c:1571: warning: comparison between pointer and integer
make[1]: *** [o/act_wiz.o] Error 1
make: *** [all] Error 2


Line 1571 has nothing to do with mfind at all, and as I said before, I can't find anything wrong with what I added. Would someone please help me?
USA #1
You need to use str_cmp to compare strings.

Also with this line:
   if( arg[3] == '\0' && !"God" && !"god" )

The logic there doesn't work (you're checking a string literal). I suggest you read up on some programming tutorials such as cprogramming.com.