Kkalun writes, "This is what I did to create ne, nw, se, and sw. It seemed way easier than the other patches for ordinal directions...." This is what I did to create ne, nw, se, and sw. It seemed way easier than the other patches for ordinal directions. This was on modified Circle 3.0bpl17 - but it *shouldn't* matter which version you're running as I didn't actually make any structural changes to the direction or movement code. All the standard disclaimers apply. This code worked for me, and *should* work for most everyone else, but if it breaks your mud, don't blame me. Be sure to make a backup of your working mud before you make these changes. Just for the sake of those who don't know, ! before a line means "change this line from whatever it is in your code to this" and + before a line means to "add this line." In constants.c, change const char *dirs[] to: ! /* directions */ const char *dirs[] = { "north", "east", "south", "west", "up", "down", + "northeast", + "northwest", + "southeast", + "southwest", "\n" }; And then, (also in constants.c) change int rev_dir[] to: int rev_dir[] = { 2, 3, 0, 1, 5, ! 4, + 7, + 6, + 9, + 8 }; In interpreter.c, add the following lines after "down": { "down", POS_STANDING, do_move , 0, SCMD_DOWN }, + { "northeast", POS_STANDING, do_move , 0, SCMD_NORTHEAST }, + { "ne" , POS_STANDING, do_move , 0, SCMD_NORTHEAST }, + { "northwest", POS_STANDING, do_move , 0, SCMD_NORTHWEST }, + { "nw" , POS_STANDING, do_move , 0, SCMD_NORTHWEST }, + { "southeast", POS_STANDING, do_move , 0, SCMD_SOUTHEAST }, + { "se" , POS_STANDING, do_move , 0, SCMD_SOUTHEAST }, + { "southwest", POS_STANDING, do_move , 0, SCMD_SOUTHWEST }, + { "sw" , POS_STANDING, do_move , 0, SCMD_SOUTHWEST }, In interpreter.h, change /* directions */ to read: /* directions */ #define SCMD_NORTH 1 #define SCMD_EAST 2 #define SCMD_SOUTH 3 #define SCMD_WEST 4 #define SCMD_UP 5 #define SCMD_DOWN 6 + #define SCMD_NORTHEAST 7 + #define SCMD_NORTHWEST 8 + #define SCMD_SOUTHEAST 9 + #define SCMD_SOUTHWEST 10 In structs.h, do the following: Change the NUM_OF_DIRS define to read: #define NUM_OF_DIRS 10 /* number of directions in a room */ Then, change the direction defines as follows: /* Directions: used as index to room_data.dir_option[] */ #define NORTH 0 #define EAST 1 #define SOUTH 2 #define WEST 3 #define UP 4 #define DOWN 5 + #define NORTHEAST 6 + #define NORTHWEST 7 + #define SOUTHEAST 8 + #define SOUTHWEST 9 If you have OasisOLC, you need to change the room edit menu in redit.c to reflect the new directions. I swiped most of this directly from StormRider's new_exits.patch code, but I had to change some of it to reflect what was going on with Oasis 2.0 - the new_exits patch was written in April of '97, and things have moved on since then. ;) In redit.c, change redit_disp_menu like this: "-- Room number : [%s%d%s] Room zone: [%s%d%s]\r\n" "%s1%s) Name : %s%s\r\n" "%s2%s) Description :\r\n%s%s" "%s3%s) Room flags : %s%s\r\n" "%s4%s) Sector type : %s%s\r\n" "%s5%s) Exit north : %s%d\r\n" "%s6%s) Exit east : %s%d\r\n" "%s7%s) Exit south : %s%d\r\n" "%s8%s) Exit west : %s%d\r\n" "%s9%s) Exit up : %s%d\r\n" "%sA%s) Exit down : %s%d\r\n" + "%sB%s) Exit northeast : %s%d\r\n" + "%sC%s) Exit northwest : %s%d\r\n" + "%sD%s) Exit southeast : %s%d\r\n" + "%sE%s) Exit southwest : %s%d\r\n" ! "%sF%s) Extra descriptions menu\r\n" "%sQ%s) Quit\r\n" "Enter choice : ", And then add the following lines after: room->dir_option[DOWN] && room->dir_option[DOWN]->to_room != -1 ? world[room->dir_option[DOWN]->to_room].number : -1, + grn, nrm, cyn, + room->dir_option[NORTHEAST] && room->dir_option[NORTHEAST]->to_room != -1 ? + world[room->dir_option[NORTHEAST]->to_room].number : -1, + grn, nrm, cyn, + room->dir_option[NORTHWEST] && room->dir_option[NORTHWEST]->to_room != -1 ? + world[room->dir_option[NORTHWEST]->to_room].number : -1, + grn, nrm, cyn, + room->dir_option[SOUTHEAST] && room->dir_option[SOUTHEAST]->to_room != -1 ? + world[room->dir_option[SOUTHEAST]->to_room].number : -1, + grn, nrm, cyn, + room->dir_option[SOUTHWEST] && room->dir_option[SOUTHWEST]->to_room != -1 ? + world[room->dir_option[SOUTHWEST]->to_room].number : -1, grn, nrm, grn, nrm ); Then insert the following into the case statements for REDIT_MAIN_MENU: case 'b': case 'B': + OLC_VAL(d) = NORTHEAST; + redit_disp_exit_menu(d); + break; + case 'c': + case 'C': + OLC_VAL(d) = NORTHWEST; + redit_disp_exit_menu(d); + break; + case 'd': + case 'D': + OLC_VAL(d) = SOUTHEAST; + redit_disp_exit_menu(d); + break; + case 'e': + case 'E': + OLC_VAL(d) = SOUTHWEST; + redit_disp_exit_menu(d); + break; + case 'f': + case 'F': /* * If the extra description doesn't exist. */ I didn't have any trouble with this *except* I had to 'make clean' before compiling it, otherwise I ended up crashing the mud with a weird segmentation fault (gdb was a *real* help. It told me: "#0 0x19 in ?? () ". So... before you compile this, be sure to 'make clean'. As for credit, don't worry about it (there's nothing I can see in StormRider's code that asks for credit, either). Anyway. Have fun and enjoy your new directions. << Worth command [by Taerin] | Reply | Flattened | Astat command [by Josh Anderson] >>
|
|
|
Doh: Ordinal directions fix by Kkalun (kkalun@hotmail.com) on Tuesday, July 4th @ 08:06:48 AM http:// |
I use long exits on my mud (like when you type exits on stock) and so didn't notice this problem. When you use the ordinal directions code as is, you end up with something like: [Exits: n s e w u d n s] The last two characters are supposed to be northeast and southwest. So: To fix that add the following to constants.c: const char *sdirs[] = { "n", "e", "s", "w", "u", "d", "ne", "nw", "se", "sw", " " }; Add to constants.h: extern const char *sdirs[]; and in act.informative.c in the look_at_room function: change slen += sprintf(buf + slen, "%c ", LOWER(*dirs[door])); to: slen += sprintf(buf+slen, "%s ", sdirs[door]); That ought to fix it. Sorry about that :) -Kkalun |
[ Reply to this comment ] |
|
|
what about "look ne"? by Peter Ajamian (peter@pajamian.dhs.org) on Saturday, August 12th @ 12:42:37 PM http:// |
Your directions snippet will work fine if someone wants to go northeast by typing "ne" but, if someone wants to "look ne" or "dig ne", etc. they will have to at the least type "look northe" or "dig northe". Check out my directions snippet (it was written a little while back for bpl15 but still goes in clean and easy AFAIK). You'rs is almost identical to what mine is with the exception that I make provisions for the above plus I give details on how to convert some of the more popular commands that work with directions. No offense but I think you may have just re-invented the wheel. ;) Regards, Peter |
[ Reply to this comment ] |
|