Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, 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.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Compass Snippet

Compass Snippet

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Awillan86   (6 posts)  Bio
Date Wed 30 Jun 2004 02:33 PM (UTC)
Message
Alright, I hate to do this to you people, but I couldn't find an exact answer to my question on the forums. I'm trying to add:

Altanos Compass Display
-----------------------

Original code from the Altanos codebase.
Modified for stock Smaug compatibility by Samson of Alsherok.

The I got off of http://www.alsherok.net. Now, here is my problem. I know some java and visual basic, so I have a general idea of how the code works, however I know no C/C++. I'm getting this on compile: (with cygwin)

Compiling o/act_info.o
act_info.c: In function 'print_compass':
act_info.c:916: warning: implicit declaration of function
'IS_EXIT_FLAG'
act_info.c:931: warning: implicit declaration of function
'MXP_ON'
act_info.c:931: error 'MXP_TAG_ROOMNAME' undeclared (..ob.
definition here..)
(Each undec. ident. is reported only once...)
act_info.c:932: error 'MXP_TAG_ROOMNAME_CLOSE' undeclared
(..ob. definition here..)
act_info.c:935: warning: implicit declaration of function
'IS_EXIT_FLAG'
make[1]: *** [o/act_info.o] Error 1
make: *** [all] Error 2

So I search all the c and h files, and I found no IS_EXIT_FLAG function. Am I missing some all important snippet that everyone has? Oh, and I am using SmaugFUSS with a few other snippets in, none of which effect this one in anyway.
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #1 on Wed 30 Jun 2004 02:46 PM (UTC)

Amended on Wed 30 Jun 2004 02:47 PM (UTC) by Nick Cash

Message
Remove lines relative to MXP unless your mud uses it. If you have not added your self (which, if you know no C/C++ would be a feat in itself) then your dont have it because SmaugFUSS doens't come with it. As for the declarations (sry, not quite sure, I've been up 26+ hours :P) is either warning you of conflicting definitions, called the function wrong, don't have the function, or having no prototype definition at all. I'd say post the relevent sections of code (910-920 or so should do it). Again, safely remove references to MXP.

~Nick Cash
http://www.nick-cash.com
Top

Posted by Awillan86   (6 posts)  Bio
Date Reply #2 on Wed 30 Jun 2004 02:53 PM (UTC)
Message
Wow, that was quick :P. Well, once again, I dont know too much about C, so thats that. I had downloaded AFKMud the other day, and so on a whim I did a search through the code. It is FILTHY with references to IS_EXIT_FLAG. So I found the line in mud.h and copied it over to the same general spot:

#define IS_EXIT_FLAG(var, bit) xIS_SET((var)->exit_info, (bit))

Well, I now longer get the imp dec errors anymore, instead i get:

error: request for member 'bits' in something not a structure or union

Everytime it calls IS_EXIT_FLAG. The code thats giving problems is this:

void print_compass( CHAR_DATA *ch )
{
EXIT_DATA *pexit;
int exit_info[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static char * const exit_colors [] = { "&w", "&Y", "&C", "&b", "&w", "&R" };
for( pexit = ch->in_room->first_exit; pexit; pexit = pexit->next )
{
if( !pexit->to_room || IS_EXIT_FLAG( pexit, EX_HIDDEN ) ||
( IS_EXIT_FLAG( pexit, EX_SECRET ) && IS_EXIT_FLAG( pexit, EX_CLOSED ) ) )
continue;
if( IS_EXIT_FLAG( pexit, EX_WINDOW ) )
exit_info[pexit->vdir] = 2;
else if( IS_EXIT_FLAG( pexit, EX_SECRET ) )
exit_info[pexit->vdir] = 3;
else if( IS_EXIT_FLAG( pexit, EX_CLOSED ) )
exit_info[pexit->vdir] = 4;
else if( IS_EXIT_FLAG( pexit, EX_LOCKED ) )
exit_info[pexit->vdir] = 5;
else
exit_info[pexit->vdir] = 1;
}
set_char_color( AT_RMNAME, ch );
ch_printf_color( ch, "\n\r%s%-50s%s %s%s %s%s %s%s\n\r", MXP_ON(ch) ? MXP_TAG_ROOMNAME : "", ch->in_room->name,
MXP_ON(ch) ? MXP_TAG_ROOMNAME_CLOSE : "", exit_colors[exit_info[DIR_NORTHWEST]], exit_info[DIR_NORTHWEST] ? "NW" : "- ",
exit_colors[exit_info[DIR_NORTH]], exit_info[DIR_NORTH] ? "N" : "-", exit_colors[exit_info[DIR_NORTHEAST]],
exit_info[DIR_NORTHEAST] ? "NE" : " -" );
if( IS_IMMORTAL( ch ) && IS_PLR_FLAG( ch, PLR_ROOMVNUM ) )
ch_printf_color( ch, "&w-<---- &YVnum: %6d &w----------------------------->- ", ch->in_room->vnum );
else
send_to_char_color( "&w-<----------------------------------------------->- ", ch );
ch_printf_color( ch, "%s%s&w<-%s%s&w-&W(*)&w-%s%s&w->%s%s\n\r", exit_colors[exit_info[DIR_WEST]], exit_info[DIR_WEST] ? "W" : "-",
exit_colors[exit_info[DIR_UP]], exit_info[DIR_UP] ? "U" : "-", exit_colors[exit_info[DIR_DOWN]], exit_info[DIR_DOWN] ? "D" : "-",
exit_colors[exit_info[DIR_EAST]], exit_info[DIR_EAST] ? "E" : "-" );
ch_printf_color( ch, " %s%s %s%s %s%s\n\r\n\r",
exit_colors[exit_info[DIR_SOUTHWEST]], exit_info[DIR_SOUTHWEST] ? "SW" : "- ", exit_colors[exit_info[DIR_SOUTH]],
exit_info[DIR_SOUTH] ? "S" : "-", exit_colors[exit_info[DIR_SOUTHEAST]], exit_info[DIR_SOUTHEAST] ? "SE" : " -" );
return;
}
Top

Posted by Awillan86   (6 posts)  Bio
Date Reply #3 on Wed 30 Jun 2004 02:54 PM (UTC)
Message
I'm also willing to give up and try a different snippet if anyone has any suggestions :P
Top

Posted by Awillan86   (6 posts)  Bio
Date Reply #4 on Wed 30 Jun 2004 02:56 PM (UTC)
Message
:P Added that line already, see? And about the MXP, should I just hack it right out?
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #5 on Wed 30 Jun 2004 03:19 PM (UTC)
Message
Yes, just take it out. For example:
ch_printf_color( ch, "\n\r%-50s%s %s%s %s%s %s%s\n\r",  exit_colors[exit_info[DIR_NORTHWEST]], exit_info[DIR_NORTHWEST] ? "NW" : "- ",
exit_colors[exit_info[DIR_NORTH]], exit_info[DIR_NORTH] ? "N" : "-", exit_colors[exit_info[DIR_NORTHEAST]],
exit_info[DIR_NORTHEAST] ? "NE" : " -" );


Double check that your doors have flags compatible with xflags. You can try just removing the "x" in "xIS_SET". If it compiles properly afterward, then it just meant that your exit flags are not extended flags.

I would also recommend that you try on the board that is listed in the instruction from the snippet. Samson is more likely to be able to give you info there.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Awillan86   (6 posts)  Bio
Date Reply #6 on Wed 30 Jun 2004 03:51 PM (UTC)
Message
OK, I'll, try that out, and if I still have problems, I'll post there. Thanks alot. :D
Top

Posted by Samson   USA  (683 posts)  Bio
Date Reply #7 on Thu 01 Jul 2004 01:15 AM (UTC)

Amended on Thu 01 Jul 2004 01:22 AM (UTC) by Samson

Message
I'd also like to point out that if there are problems with snippets from my site it is usually far more productive to come to our forums and discuss the issue there. One of us is far more likely to see it.

As for being "FILTHY" with IS_EXIT_FLAG macros, you did attempt to siphon it from a codebase which isn't strictly compatible with Smaug anymore. These things are bound to happen. Greven has the right advice though, just take the x out of the xIS_SET part of the macro and it will work fine.

Regarding the compass code itself, I looked over it again and fixed the compatibility issues.
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.


19,811 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.