Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ Programming
➜ General
➜ Weird Compiler Error
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Terry
USA (87 posts) Bio
|
| Date
| Sun 01 Apr 2007 01:56 PM (UTC) |
| Message
| 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? | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #1 on Sun 01 Apr 2007 05:01 PM (UTC) Amended on Sun 01 Apr 2007 05:16 PM (UTC) by Zeno
|
| Message
| 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. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
11,765 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top