Altanos Compass Display ----------------------- Original code from the Altanos codebase. Modified for stock Smaug compatibility by Samson of Alsherok. Terms of Use ------------ 1. You may use this snippet in your code provided that any included comment headers in the code are left intact. You may add your own, but do not take mine out. 2. This snippet may not be posted for redistribution on any site without obtaining prior written consent from the Alsherok team. 3. ( optional ) Register with the forums at http://forums.alsherok.net Registration is not required to make use of the snippet, but since I no longer provide email support for any of the code I release, forum posts are your only avenue for direct support. This may seem overly stupid, but you can blame the continuing abuse I suffer from spammers for this. Don't post stuff to TMC or TMS asking about my code. I'm highly unlikely to ever notice it there on the rare ocassions I skim posts in either place. If forum registration doesn't appeal to you, then you can try to get ahold of me via IMC on the code channel. If you can't agree to these terms, don't use this code, and don't expect me to help if something breaks while installing it. Harsh? Hardly. I'm tired of people who come crawling to whine and complain when they haven't bothered to comply with the terms first. What this code does ------------------- This code adds a compass display to the do_look command that will show a directional compass of the exits for the room the player is standing in. Produces output like this: look The Great Void NW N NE -<----------------------------------------------->- W<-U-(*)-D->E SW S SE [Exits: North East South West Up Down Northeast Northwest Southeast Southwest] All around you is nothing but the vast blackness of the void. There isn't a lot to see aside from the billions and billions of stars and galaxies. The void stretches infinitely in all directions. Exit indicators are colored to show the status of any doors the player can see. Installation Instructions ------------------------- 1. Open act_info.c and locate function do_look Directly ABOVE do_look, add the following: void print_compass( CHAR_DATA *ch ) { EXIT_DATA *pexit; int exit_info[] = { 0, 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_SET( pexit->exit_info, EX_HIDDEN ) || ( IS_SET( pexit->exit_info, EX_SECRET ) && IS_SET( pexit->exit_info, EX_CLOSED ) ) ) continue; if( IS_SET( pexit->exit_info, EX_WINDOW ) ) exit_info[pexit->vdir] = 2; else if( IS_SET( pexit->exit_info, EX_SECRET ) ) exit_info[pexit->vdir] = 3; else if( IS_SET( pexit->exit_info, EX_CLOSED ) ) exit_info[pexit->vdir] = 4; else if( IS_SET( pexit->exit_info, EX_LOCKED ) ) exit_info[pexit->vdir] = 5; else exit_info[pexit->vdir] = 1; } set_char_color( AT_RMNAME, ch ); ch_printf_color( ch, "\r\n%-50s %s%s %s%s %s%s\r\n", ch->in_room->name, 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 ) && xIS_SET( ch->act, 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\r\n", 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\r\n\r\n", 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; } The in do_look, locate the following code: /* 'look' or 'look auto' */ set_char_color( AT_RMNAME, ch ); send_to_char( ch->in_room->name, ch ); send_to_char( "\r\n", ch ); Replace that block with the following: /* 'look' or 'look auto' */ if( xIS_SET( ch->act, PLR_COMPASS ) ) print_compass( ch ); else { set_char_color( AT_RMNAME, ch ); send_to_char( ch->in_room->name, ch ); send_to_char( "\r\n", ch ); } Then locate function do_config and find the following: ch_printf( ch, "%-12s %-12s %-12s %-12s\r\n %-12s %-12s %-12s %-12s", IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? "[+] PAGER" : "[-] pager", IS_SET( ch->pcdata->flags, PCFLAG_GAG ) ? "[+] GAG" : "[-] gag", xIS_SET(ch->act, PLR_BRIEF ) ? "[+] BRIEF" : "[-] brief", xIS_SET(ch->act, PLR_COMBINE ) ? "[+] COMBINE" : "[-] combine", xIS_SET(ch->act, PLR_BLANK ) ? "[+] BLANK" : "[-] blank", xIS_SET(ch->act, PLR_PROMPT ) ? "[+] PROMPT" : "[-] prompt", xIS_SET(ch->act, PLR_ANSI ) ? "[+] ANSI" : "[-] ansi", xIS_SET(ch->act, PLR_RIP ) ? "[+] RIP" : "[-] rip" ); Change it to read as follows: ch_printf( ch, "%-12s %-12s %-12s %-12s\r\n %-12s %-12s %-12s %-12s\r\n %-12s", IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? "[+] PAGER" : "[-] pager", IS_SET( ch->pcdata->flags, PCFLAG_GAG ) ? "[+] GAG" : "[-] gag", xIS_SET( ch->act, PLR_BRIEF ) ? "[+] BRIEF" : "[-] brief", xIS_SET( ch->act, PLR_COMBINE ) ? "[+] COMBINE" : "[-] combine", xIS_SET( ch->act, PLR_BLANK ) ? "[+] BLANK" : "[-] blank", xIS_SET( ch->act, PLR_PROMPT ) ? "[+] PROMPT" : "[-] prompt", xIS_SET( ch->act, PLR_ANSI ) ? "[+] ANSI" : "[-] ansi", xIS_SET( ch->act, PLR_RIP ) ? "[+] RIP" : "[-] rip", xIS_SET( ch->act, PLR_COMPASS ) ? "[+] COMPASS" : "[-] compass" ); Then locate the following code: else if ( !str_prefix( arg+1, "ansi" ) ) bit = PLR_ANSI; else if ( !str_prefix( arg+1, "rip" ) ) bit = PLR_RIP; Directly below that, add the following line: else if ( !str_prefix( arg+1, "compass" ) ) bit = PLR_COMPASS; 2. Open mud.h and locate the player_flags Add PLR_COMPASS to the list. 3. Open build.c and locate the plr_flags array Add "compass" to the list in the same position that corresponds to where you added PLR_COMPASS in mud.h 4. Make clean, recompile. If there are any problems with this installation, feel free to post your question to the forums at http://forums.alsherok.net This code has been installed and tested on Smaug 1.6 FUSS, which is a bugfixed and cleaned up version of the base Smaug 1.4a code. The Smaug FUSS Project is maintained on servers which run the Redhat and Fedora family of Linux. Limited testing has also been done on the Cygwin package under WindowsXP SP1 and SP2. Users of BSD, MSVC, MSVC++, or Macintosh platforms are on their own as The Smaug FUSS Project does not have access to these development environments for testing. The Smaug FUSS Project can be found at: http://www.smaugfuss.org No guarantees are made that this code will be compatible with your codebase and any modifications you may have made to it. No warranty of any kind is expressed or implied by the use of this code, and we are not responsible for any damages which may result from the application of this snippet to your codebase. Adventure beckons in the lands of mystique.... Samson, Implementor of Alsherok http://www.alsherok.net telnet://alsherok.net:5500 IMC2 contact: Samson@Alsherok