From 5acbfd29eb27f8c27e2aeb179b1f31aea7e01720 Mon Sep 17 00:00:00 2001 From: JamDog Date: Thu, 25 Nov 2010 16:24:53 +0000 Subject: [PATCH] Added diagonal directions, hidden exits flag and bug fixes --- changelog | 5 ++ src/act.comm.c | 6 +- src/act.informative.c | 28 ++++++--- src/act.movement.c | 20 ++++--- src/act.offensive.c | 2 +- src/act.wizard.c | 18 +++--- src/asciimap.c | 77 ++++++++++++++++++++++--- src/cedit.c | 13 ++++- src/config.c | 4 ++ src/config.h | 1 + src/constants.c | 25 +++++++- src/constants.h | 1 + src/db.c | 18 +++++- src/dg_mobcmd.c | 2 +- src/dg_objcmd.c | 26 ++++----- src/dg_triggers.c | 14 ++--- src/dg_variables.c | 4 +- src/dg_wldcmd.c | 16 +++--- src/fight.c | 2 +- src/genolc.c | 4 +- src/genwld.c | 13 +++-- src/graph.c | 10 ++-- src/house.c | 2 +- src/interpreter.c | 8 +++ src/interpreter.h | 4 ++ src/mobact.c | 16 +++--- src/oasis_delete.c | 2 +- src/oasis_list.c | 4 +- src/redit.c | 130 ++++++++++++++++++++++++++++++++++-------- src/spec_procs.c | 5 +- src/structs.h | 17 ++++-- src/utils.h | 9 +++ src/zedit.c | 2 +- 33 files changed, 378 insertions(+), 130 deletions(-) diff --git a/changelog b/changelog index 49e3732..69b3104 100644 --- a/changelog +++ b/changelog @@ -35,6 +35,11 @@ export (QQ's a zone into a tarball) Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist) (lots of major bugfixes too) @ +[Nov 25 2010] - Jamdog + Added diagonal directions with cedit toggle (default to 'off') + Bug-Fix: admin default now targets the victim player + Bug-Fix: Crash bug developed due to no 'vict' in is_tell_ok, added checks + Added HIDDEN flag for doors, hiding from exits, autoexits, scan and map [Nov 24 2010] - Jamdog Split mortal and admin levels (thanks fnord for original patch/idea) Mortal level converted to ubyte for 255 max diff --git a/src/act.comm.c b/src/act.comm.c index 871592b..4303193 100644 --- a/src/act.comm.c +++ b/src/act.comm.c @@ -111,7 +111,11 @@ static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg static int is_tell_ok(struct char_data *ch, struct char_data *vict) { - if (ch == vict) + if (!ch) + log("SYSERR: is_tell_ok called with no characters"); + else if (!vict) + send_to_char(ch, "%s", CONFIG_NOPERSON); + else if (ch == vict) send_to_char(ch, "You try to tell yourself something.\r\n"); else if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOTELL)) send_to_char(ch, "You can't tell other people while you have notell on.\r\n"); diff --git a/src/act.informative.c b/src/act.informative.c index 710de16..bc735de 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -408,15 +408,20 @@ static void do_auto_exits(struct char_data *ch) send_to_char(ch, "%s[ Exits: ", CCCYN(ch, C_NRM)); - for (door = 0; door < NUM_OF_DIRS; door++) { + for (door = 0; door < DIR_COUNT; door++) { if (!EXIT(ch, door) || EXIT(ch, door)->to_room == NOWHERE) continue; if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS) continue; + if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !ADM_FLAGGED(ch, ADM_SEESECRET)) + continue; + if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) - send_to_char(ch, "%s(%c)%s ", CCRED(ch, C_NRM), LOWER(*dirs[door]), CCCYN(ch, C_NRM)); + send_to_char(ch, "%s(%s)%s ", EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? CCWHT(ch, C_NRM) : CCRED(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM)); + else if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN)) + send_to_char(ch, "%s%s%s ", CCWHT(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM)); else - send_to_char(ch, "%c ", LOWER(*dirs[door])); + send_to_char(ch, "%s ", autoexits[door]); slen++; } @@ -434,20 +439,24 @@ ACMD(do_exits) send_to_char(ch, "Obvious exits:\r\n"); - for (door = 0; door < NUM_OF_DIRS; door++) { + for (door = 0; door < DIR_COUNT; door++) { if (!EXIT(ch, door) || EXIT(ch, door)->to_room == NOWHERE) continue; if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS) continue; + if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !ADM_FLAGGED(ch, ADM_SEESECRET)) + continue; len++; if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && !EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) - send_to_char(ch, "%-5s - [%5d] %s\r\n", dirs[door], GET_ROOM_VNUM(EXIT(ch, door)->to_room), world[EXIT(ch, door)->to_room].name); + send_to_char(ch, "%-5s - [%5d]%s %s\r\n", dirs[door], GET_ROOM_VNUM(EXIT(ch, door)->to_room), + EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? " [HIDDEN]" : "", world[EXIT(ch, door)->to_room].name); else if (CONFIG_DISP_CLOSED_DOORS && EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) { /* But we tell them the door is closed */ - send_to_char(ch, "%-5s - The %s is closed.\r\n", dirs[door], - (EXIT(ch, door)->keyword)? fname(EXIT(ch, door)->keyword) : "opening" ); + send_to_char(ch, "%-5s - The %s is closed%s\r\n", dirs[door], + (EXIT(ch, door)->keyword)? fname(EXIT(ch, door)->keyword) : "opening", + EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? " and hidden." : "."); } else send_to_char(ch, "%-5s - %s\r\n", dirs[door], IS_DARK(EXIT(ch, door)->to_room) && @@ -2673,10 +2682,11 @@ ACMD(do_scan) return; } - for (door = 0; door < NUM_OF_DIRS; door++) { + for (door = 0; door < DIR_COUNT; door++) { for (range = 1; range<= maxrange; range++) { if (world[scanned_room].dir_option[door] && world[scanned_room].dir_option[door]->to_room != NOWHERE && - !IS_SET(world[scanned_room].dir_option[door]->exit_info, EX_CLOSED)) { + !IS_SET(world[scanned_room].dir_option[door]->exit_info, EX_CLOSED) && + !IS_SET(world[scanned_room].dir_option[door]->exit_info, EX_HIDDEN)) { scanned_room = world[scanned_room].dir_option[door]->to_room; if (IS_DARK(scanned_room) && !CAN_SEE_IN_DARK(ch)) { if (world[scanned_room].people) diff --git a/src/act.movement.c b/src/act.movement.c index 4ed8bd2..cc46a9e 100644 --- a/src/act.movement.c +++ b/src/act.movement.c @@ -342,8 +342,10 @@ int perform_move(struct char_data *ch, int dir, int need_specials_check) room_rnum was_in; struct follow_type *k, *next; - if (ch == NULL || dir < 0 || dir >= NUM_OF_DIRS || FIGHTING(ch)) + if (ch == NULL || dir < 0 || dir >= DIR_COUNT || FIGHTING(ch)) return (0); + else if (!CONFIG_DIAGONAL_DIRS && IS_DIAGONAL(dir)) + send_to_char(ch, "Alas, you cannot go that way...\r\n"); else if ((!EXIT(ch, dir) && !buildwalk(ch, dir)) || EXIT(ch, dir)->to_room == NOWHERE) send_to_char(ch, "Alas, you cannot go that way...\r\n"); else if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && (!ADM_FLAGGED(ch, ADM_WALKANYWHERE)) ) { @@ -383,9 +385,11 @@ static int find_door(struct char_data *ch, const char *type, char *dir, const ch int door; if (*dir) { /* a direction was specified */ - if ((door = search_block(dir, dirs, FALSE)) == -1) { /* Partial Match */ - send_to_char(ch, "That's not a direction.\r\n"); - return (-1); + if ((door = search_block(dir, dirs, FALSE)) == -1) { /* Partial Match */ + if ((door = search_block(dir, autoexits, FALSE)) == -1) { /* Check 'short' dirs too */ + send_to_char(ch, "That's not a direction.\r\n"); + return (-1); + } } if (EXIT(ch, door)) { /* Braces added according to indent. -gg */ if (EXIT(ch, door)->keyword) { @@ -406,7 +410,7 @@ static int find_door(struct char_data *ch, const char *type, char *dir, const ch send_to_char(ch, "What is it you want to %s?\r\n", cmdname); return (-1); } - for (door = 0; door < NUM_OF_DIRS; door++) + for (door = 0; door < DIR_COUNT; door++) { if (EXIT(ch, door)) { @@ -684,7 +688,7 @@ ACMD(do_enter) if (*buf) { /* an argument was supplied, search for door * keyword */ - for (door = 0; door < NUM_OF_DIRS; door++) + for (door = 0; door < DIR_COUNT; door++) if (EXIT(ch, door)) if (EXIT(ch, door)->keyword) if (!str_cmp(EXIT(ch, door)->keyword, buf)) { @@ -696,7 +700,7 @@ ACMD(do_enter) send_to_char(ch, "You are already indoors.\r\n"); else { /* try to locate an entrance */ - for (door = 0; door < NUM_OF_DIRS; door++) + for (door = 0; door < DIR_COUNT; door++) if (EXIT(ch, door)) if (EXIT(ch, door)->to_room != NOWHERE) if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && @@ -715,7 +719,7 @@ ACMD(do_leave) if (OUTSIDE(ch)) send_to_char(ch, "You are outside.. where do you want to go?\r\n"); else { - for (door = 0; door < NUM_OF_DIRS; door++) + for (door = 0; door < DIR_COUNT; door++) if (EXIT(ch, door)) if (EXIT(ch, door)->to_room != NOWHERE) if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && diff --git a/src/act.offensive.c b/src/act.offensive.c index e0aab90..af8d537 100644 --- a/src/act.offensive.c +++ b/src/act.offensive.c @@ -238,7 +238,7 @@ ACMD(do_flee) } for (i = 0; i < 6; i++) { - attempt = rand_number(0, NUM_OF_DIRS - 1); /* Select a random direction */ + attempt = rand_number(0, DIR_COUNT - 1); /* Select a random direction */ if (CAN_GO(ch, attempt) && !ROOM_FLAGGED(EXIT(ch, attempt)->to_room, ROOM_DEATH)) { act("$n panics, and attempts to flee!", TRUE, ch, 0, 0, TO_ROOM); diff --git a/src/act.wizard.c b/src/act.wizard.c index ad25db6..b6e3a69 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -570,7 +570,7 @@ static void do_stat_room(struct char_data *ch, struct room_data *rm) send_to_char(ch, "%s", CCNRM(ch, C_NRM)); } - for (i = 0; i < NUM_OF_DIRS; i++) { + for (i = 0; i < DIR_COUNT; i++) { char buf1[128]; if (!rm->dir_option[i]) @@ -1687,11 +1687,11 @@ ACMD(do_admin) } } else if (is_abbrev(arg2, "default")) { /* Copy current flags */ - for (i=0; ito_room == 0) { @@ -3654,7 +3654,7 @@ ACMD(do_links) send_to_char(ch, "Zone %d is linked to the following zones:\r\n", zvnum); for (nr = 0; nr <= top_of_world && (GET_ROOM_VNUM(nr) <= last); nr++) { if (GET_ROOM_VNUM(nr) >= first) { - for (j = 0; j < NUM_OF_DIRS; j++) { + for (j = 0; j < DIR_COUNT; j++) { if (world[nr].dir_option[j]) { to_room = world[nr].dir_option[j]->to_room; if (to_room != NOWHERE && (zrnum != world[to_room].zone)) @@ -4023,7 +4023,7 @@ ACMD (do_zcheck) send_to_char(ch, "\r\nChecking Rooms for limits...\r\n"); for (i=0; ito_room > 0 ) && (pexit->to_room != NOWHERE) && - (!IS_SET(pexit->exit_info, EX_CLOSED))) { /* A real exit */ + (!IS_SET(pexit->exit_info, EX_CLOSED)) && + (!IS_SET(pexit->exit_info, EX_HIDDEN) || ADM_FLAGGED(ch, ADM_SEESECRET)) ) + { /* A real exit */ /* But is the door here... */ switch (door) { @@ -250,6 +276,18 @@ static void MapArea(room_rnum room, struct char_data *ch, int x, int y, int min, case WEST: if(ypos > 0 || xpos!=x_exit_pos) continue; break; + case NORTHWEST: + if(xpos > 0 || ypos!=y_exit_pos || ypos > 0 || xpos!=x_exit_pos) continue; + break; + case NORTHEAST: + if(xpos > 0 || ypos!=y_exit_pos || ypos < ew_size || xpos!=x_exit_pos) continue; + break; + case SOUTHEAST: + if(xpos < ns_size || ypos!=y_exit_pos || ypos < ew_size || xpos!=x_exit_pos) continue; + break; + case SOUTHWEST: + if(xpos < ns_size || ypos!=y_exit_pos || ypos > 0 || xpos!=x_exit_pos) continue; + break; } @@ -263,8 +301,21 @@ static void MapArea(room_rnum room, struct char_data *ch, int x, int y, int min, return; } - if(!worldmap) - map[x+door_offsets[door][0]][y+door_offsets[door][1]] = door_marks[door] ; + if(!worldmap) { + if ((map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_NONE) || + (map[x+door_offsets[door][0]][y+door_offsets[door][1]] == SECT_EMPTY) ) { + map[x+door_offsets[door][0]][y+door_offsets[door][1]] = door_marks[door]; + } else { + if ( ((door == NORTHEAST) && (map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_UP)) || + ((door == UP) && (map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_DIAGNE)) ) { + map[x+door_offsets[door][0]][y+door_offsets[door][1]] = DOOR_UP_AND_NE; + } + else if ( ((door == SOUTHEAST) && (map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_DOWN)) || + ((door == DOWN) && (map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_DIAGNW)) ) { + map[x+door_offsets[door][0]][y+door_offsets[door][1]] = DOOR_DOWN_AND_SE; + } + } + } prospect_xpos = prospect_ypos = 0; switch (door) { @@ -277,6 +328,14 @@ static void MapArea(room_rnum room, struct char_data *ch, int x, int y, int min, prospect_ypos = ew_size; case EAST: prospect_xpos = world[prospect_room].dir_option[rev_dir[door]] ? x_exit_pos : ns_size/2; + break; + case NORTHEAST: + case NORTHWEST: + case SOUTHEAST: + case SOUTHWEST: + prospect_xpos = world[prospect_room].dir_option[rev_dir[door]] ? x_exit_pos : ns_size/2; + prospect_ypos = world[prospect_room].dir_option[rev_dir[door]] ? y_exit_pos : ew_size/2; + break; } if(worldmap) { diff --git a/src/cedit.c b/src/cedit.c index 165cc61..b4d38d0 100644 --- a/src/cedit.c +++ b/src/cedit.c @@ -101,6 +101,7 @@ static void cedit_setup(struct descriptor_data *d) OLC_CONFIG(d)->play.track_through_doors = CONFIG_TRACK_T_DOORS; OLC_CONFIG(d)->play.no_mort_to_immort = CONFIG_NO_MORT_TO_IMMORT; OLC_CONFIG(d)->play.disp_closed_doors = CONFIG_DISP_CLOSED_DOORS; + OLC_CONFIG(d)->play.diagonal_dirs = CONFIG_DIAGONAL_DIRS; OLC_CONFIG(d)->play.map_option = CONFIG_MAP; OLC_CONFIG(d)->play.map_size = CONFIG_MAP_SIZE; OLC_CONFIG(d)->play.minimap_size = CONFIG_MINIMAP_SIZE; @@ -200,6 +201,7 @@ static void cedit_save_internally(struct descriptor_data *d) CONFIG_TRACK_T_DOORS = OLC_CONFIG(d)->play.track_through_doors; CONFIG_NO_MORT_TO_IMMORT = OLC_CONFIG(d)->play.no_mort_to_immort; CONFIG_DISP_CLOSED_DOORS = OLC_CONFIG(d)->play.disp_closed_doors; + CONFIG_DIAGONAL_DIRS = OLC_CONFIG(d)->play.diagonal_dirs; CONFIG_MAP = OLC_CONFIG(d)->play.map_option; CONFIG_MAP_SIZE = OLC_CONFIG(d)->play.map_size; CONFIG_MINIMAP_SIZE = OLC_CONFIG(d)->play.minimap_size; @@ -365,6 +367,8 @@ int save_config( IDXTYPE nowhere ) "no_mort_to_immort = %d\n\n", CONFIG_NO_MORT_TO_IMMORT); fprintf(fl, "* Should closed doors be shown on autoexit / exit?\n" "disp_closed_doors = %d\n\n", CONFIG_DISP_CLOSED_DOORS); + fprintf(fl, "* Are diagonal directions enabled?\n" + "diagonal_dirs_enabled = %d\n\n", CONFIG_DIAGONAL_DIRS); fprintf(fl, "* Who can use the map functions? 0=off, 1=on, 2=imm_only\n" "map_option = %d\n\n", CONFIG_MAP); fprintf(fl, "* Default size of map shown by 'map' command\n" @@ -603,7 +607,8 @@ static void cedit_disp_game_play_options(struct descriptor_data *d) "%sO%s) Objects Load Into Inventory : %s%s\r\n" "%sP%s) Track Through Doors : %s%s\r\n" "%sR%s) Display Closed Doors : %s%s\r\n" - "%sS%s) Mortals Level To Immortal : %s%s\r\n" + "%sS%s) Diagonal Directions : %s%s\r\n" + "%sT%s) Mortals Level To Immortal : %s%s\r\n" "%s1%s) OK Message Text : %s%s" "%s2%s) NOPERSON Message Text : %s%s" "%s3%s) NOEFFECT Message Text : %s%s" @@ -631,6 +636,7 @@ static void cedit_disp_game_play_options(struct descriptor_data *d) grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.load_into_inventory), grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.track_through_doors), grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.disp_closed_doors), + grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.diagonal_dirs), grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.no_mort_to_immort), grn, nrm, cyn, OLC_CONFIG(d)->play.OK, @@ -952,6 +958,11 @@ void cedit_parse(struct descriptor_data *d, char *arg) case 's': case 'S': + TOGGLE_VAR(OLC_CONFIG(d)->play.diagonal_dirs); + break; + + case 't': + case 'T': TOGGLE_VAR(OLC_CONFIG(d)->play.no_mort_to_immort); break; diff --git a/src/config.c b/src/config.c index 979ca56..98f8d74 100644 --- a/src/config.c +++ b/src/config.c @@ -104,6 +104,10 @@ int track_through_doors = YES; * the top level that people can advance to in gain_exp() in limits.c */ int no_mort_to_immort = YES; +/* Are diagonal directions enabled? + * If set to NO, then only the 6 directions n,e,s,w,u,d are allowed */ +int diagonal_dirs_enabled = NO; + /* RENT/CRASHSAVE OPTIONS */ /* Should the MUD allow you to 'rent' for free? (i.e. if you just quit, your * objects are saved at no cost). */ diff --git a/src/config.h b/src/config.h index d600f1c..5bad0f0 100644 --- a/src/config.h +++ b/src/config.h @@ -36,6 +36,7 @@ extern const char *NOPERSON; extern const char *NOEFFECT; extern int track_through_doors; extern int no_mort_to_immort; +extern int diagonal_dirs_enabled; extern int free_rent; extern int max_obj_save; extern int min_rent_cost; diff --git a/src/constants.c b/src/constants.c index bc7d3ff..e928a6c 100644 --- a/src/constants.c +++ b/src/constants.c @@ -40,6 +40,25 @@ const char *dirs[] = "west", "up", "down", + "northwest", /* Diagonals only used if CONFIG_DIAGONAL_DIRS is set */ + "northeast", + "southeast", + "southwest", + "\n" +}; + +const char *autoexits[] = +{ + "n", + "e", + "s", + "w", + "u", + "d", + "nw", + "ne", + "se", + "sw", "\n" }; @@ -854,7 +873,11 @@ int rev_dir[] = NORTH, EAST, DOWN, - UP + UP, + SOUTHEAST, + SOUTHWEST, + NORTHWEST, + NORTHEAST }; /** How much movement is lost moving through a particular sector type. */ diff --git a/src/constants.h b/src/constants.h index 5344601..73e7f02 100644 --- a/src/constants.h +++ b/src/constants.h @@ -14,6 +14,7 @@ extern const char *tbamud_version; extern const char *dirs[]; +extern const char *autoexits[]; extern const char *admin_level_names[]; extern const char *admin_flag_names[]; extern const char *admin_flags[]; diff --git a/src/db.c b/src/db.c index 8f7e196..51cfced 100644 --- a/src/db.c +++ b/src/db.c @@ -508,7 +508,7 @@ void destroy_db(void) /* free script proto list */ free_proto_script(&world[cnt], WLD_TRIGGER); - for (itr = 0; itr < NUM_OF_DIRS; itr++) { + for (itr = 0; itr < NUM_OF_DIRS; itr++) { /* NUM_OF_DIRS here, not DIR_COUNT */ if (!world[cnt].dir_option[itr]) continue; @@ -1243,7 +1243,7 @@ void parse_room(FILE *fl, int virtual_nr) world[room_nr].people = NULL; world[room_nr].light = 0; /* Zero light sources */ - for (i = 0; i < NUM_OF_DIRS; i++) + for (i = 0; i < NUM_OF_DIRS; i++) /* NUM_OF_DIRS used here, not DIR_COUNT */ world[room_nr].dir_option[i] = NULL; world[room_nr].ex_description = NULL; @@ -1303,6 +1303,11 @@ void setup_dir(FILE *fl, int room, int dir) snprintf(buf2, sizeof(buf2), "room #%d, direction D%d", GET_ROOM_VNUM(room)+1, dir); + if (!CONFIG_DIAGONAL_DIRS && IS_DIAGONAL(dir)) { + log("Warning: Diagonal direction disabled: %s", buf2); + return; + } + CREATE(world[room].dir_option[dir], struct room_direction_data, 1); world[room].dir_option[dir]->general_description = fread_string(fl, buf2); world[room].dir_option[dir]->keyword = fread_string(fl, buf2); @@ -1319,6 +1324,10 @@ void setup_dir(FILE *fl, int room, int dir) world[room].dir_option[dir]->exit_info = EX_ISDOOR; else if (t[0] == 2) world[room].dir_option[dir]->exit_info = EX_ISDOOR | EX_PICKPROOF; + else if (t[0] == 3) + world[room].dir_option[dir]->exit_info = EX_ISDOOR | EX_HIDDEN; + else if (t[0] == 4) + world[room].dir_option[dir]->exit_info = EX_ISDOOR | EX_PICKPROOF | EX_HIDDEN; else world[room].dir_option[dir]->exit_info = 0; @@ -2616,7 +2625,7 @@ void reset_zone(zone_rnum zone) case 'D': /* set state of door */ - if (ZCMD.arg2 < 0 || ZCMD.arg2 >= NUM_OF_DIRS || + if (ZCMD.arg2 < 0 || ZCMD.arg2 >= DIR_COUNT || (world[ZCMD.arg1].dir_option[ZCMD.arg2] == NULL)) { char error[MAX_INPUT_LENGTH]; snprintf(error, sizeof(error), "door does not exist in room %d - dir %d, command disabled", world[ZCMD.arg1].number, ZCMD.arg2); @@ -3710,6 +3719,7 @@ static void load_default_config( void ) CONFIG_TRACK_T_DOORS = track_through_doors; CONFIG_NO_MORT_TO_IMMORT = no_mort_to_immort; CONFIG_DISP_CLOSED_DOORS = display_closed_doors; + CONFIG_DIAGONAL_DIRS = diagonal_dirs_enabled; CONFIG_MAP = map_option; CONFIG_MAP_SIZE = default_map_size; CONFIG_MINIMAP_SIZE = default_minimap_size; @@ -3804,6 +3814,8 @@ void load_config( void ) case 'd': if (!str_cmp(tag, "display_closed_doors")) CONFIG_DISP_CLOSED_DOORS = num; + else if (!str_cmp(tag, "diagonal_dirs_enabled")) + CONFIG_DIAGONAL_DIRS = num; else if (!str_cmp(tag, "dts_are_dumps")) CONFIG_DTS_ARE_DUMPS = num; else if (!str_cmp(tag, "donation_room_1")) diff --git a/src/dg_mobcmd.c b/src/dg_mobcmd.c index 5b83d64..635e587 100644 --- a/src/dg_mobcmd.c +++ b/src/dg_mobcmd.c @@ -72,7 +72,7 @@ ACMD(do_masound) skip_spaces(&argument); was_in_room = IN_ROOM(ch); - for (door = 0; door < NUM_OF_DIRS; door++) + for (door = 0; door < DIR_COUNT; door++) { struct room_direction_data *newexit; diff --git a/src/dg_objcmd.c b/src/dg_objcmd.c index f319358..3a0a5cf 100644 --- a/src/dg_objcmd.c +++ b/src/dg_objcmd.c @@ -144,10 +144,10 @@ static OCMD(do_oecho) else if ((room = obj_room(obj)) != NOWHERE) { - if (world[room].people) { - sub_write(argument, world[room].people, TRUE, TO_ROOM); - sub_write(argument, world[room].people, TRUE, TO_CHAR); - } + if (world[room].people) { + sub_write(argument, world[room].people, TRUE, TO_ROOM); + sub_write(argument, world[room].people, TRUE, TO_CHAR); + } } else @@ -253,7 +253,7 @@ static OCMD(do_osend) obj_log(obj, "no target found for osend"); } -/* Prints the message to everyone in the range of numbers. Thanks to Jamie +/* Prints the message to everyone in the range of numbers. Thanks to Jamie * Nelson of 4D for this contribution. */ static OCMD(do_orecho) { @@ -285,7 +285,7 @@ static OCMD(do_otimer) GET_OBJ_TIMER(obj) = atoi(arg); } -/* Transform into a different object. Note: this shouldn't be used with +/* Transform into a different object. Note: this shouldn't be used with * containers unless both objects are containers! */ static OCMD(do_otransform) { @@ -573,17 +573,17 @@ static OCMD(do_oasound) } if ((room = obj_room(obj)) == NOWHERE) { - obj_log(obj, "oecho called by object in NOWHERE"); + obj_log(obj, "oasound called by object in NOWHERE"); return; } - for (door = 0; door < NUM_OF_DIRS; door++) { + for (door = 0; door < DIR_COUNT; door++) { if (world[room].dir_option[door] != NULL && (world[room].dir_option[door])->to_room != NOWHERE && (world[room].dir_option[door])->to_room != room && - world[(world[room].dir_option[door])->to_room].people) { - sub_write(argument, world[(world[room].dir_option[door])->to_room].people, TRUE, TO_ROOM); - sub_write(argument, world[(world[room].dir_option[door])->to_room].people, TRUE, TO_CHAR); + world[(world[room].dir_option[door])->to_room].people) { + sub_write(argument, world[(world[room].dir_option[door])->to_room].people, TRUE, TO_ROOM); + sub_write(argument, world[(world[room].dir_option[door])->to_room].people, TRUE, TO_CHAR); } } } @@ -735,7 +735,7 @@ static OCMD(do_oat) } if (isdigit(*arg)) loc = real_room(atoi(arg)); - else if ((ch = get_char_by_obj(obj, arg))) loc = IN_ROOM(ch); + else if ((ch = get_char_by_obj(obj, arg))) loc = IN_ROOM(ch); if (loc == NOWHERE) { obj_log(obj, "oat: location not found (%s)", arg); @@ -748,7 +748,7 @@ static OCMD(do_oat) obj_to_room(object, loc); obj_command_interpreter(object, command); - if (object->in_room == loc) + if (object->in_room == loc) extract_obj(object); } diff --git a/src/dg_triggers.c b/src/dg_triggers.c index 30ec9f4..881c20d 100644 --- a/src/dg_triggers.c +++ b/src/dg_triggers.c @@ -216,7 +216,7 @@ int greet_mtrigger(char_data *actor, int dir) if (((IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET) && CAN_SEE(ch, actor)) || IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET_ALL)) && !GET_TRIG_DEPTH(t) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) { - if (dir>=0 && dir < NUM_OF_DIRS) + if (dir>=0 && dir < DIR_COUNT) add_var(&GET_TRIG_VARS(t), "direction", dirs[rev_dir[dir]], 0); else add_var(&GET_TRIG_VARS(t), "direction", "none", 0); @@ -569,7 +569,7 @@ int leave_mtrigger(char_data *actor, int dir) for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) { if ((IS_SET(GET_TRIG_TYPE(t), MTRIG_LEAVE) && CAN_SEE(ch, actor)) && !GET_TRIG_DEPTH(t) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) { - if (dir>=0 && dir < NUM_OF_DIRS) + if (dir>=0 && dir < DIR_COUNT) add_var(&GET_TRIG_VARS(t), "direction", dirs[dir], 0); else add_var(&GET_TRIG_VARS(t), "direction", "none", 0); @@ -597,7 +597,7 @@ int door_mtrigger(char_data *actor, int subcmd, int dir) if (IS_SET(GET_TRIG_TYPE(t), MTRIG_DOOR) && CAN_SEE(ch, actor) && !GET_TRIG_DEPTH(t) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) { add_var(&GET_TRIG_VARS(t), "cmd", cmd_door[subcmd], 0); - if (dir>=0 && dir < NUM_OF_DIRS) + if (dir>=0 && dir < DIR_COUNT) add_var(&GET_TRIG_VARS(t), "direction", dirs[dir], 0); else add_var(&GET_TRIG_VARS(t), "direction", "none", 0); @@ -916,7 +916,7 @@ int leave_otrigger(room_data *room, char_data *actor, int dir) for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) { if (TRIGGER_CHECK(t, OTRIG_LEAVE) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) { - if (dir>=0 && dir < NUM_OF_DIRS) + if (dir>=0 && dir < DIR_COUNT) add_var(&GET_TRIG_VARS(t), "direction", dirs[dir], 0); else add_var(&GET_TRIG_VARS(t), "direction", "none", 0); @@ -1029,7 +1029,7 @@ int enter_wtrigger(struct room_data *room, char_data *actor, int dir) for (t = TRIGGERS(SCRIPT(room)); t; t = t->next) { if (TRIGGER_CHECK(t, WTRIG_ENTER) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) { - if (dir>=0 && dir < NUM_OF_DIRS) + if (dir>=0 && dir < DIR_COUNT) add_var(&GET_TRIG_VARS(t), "direction", dirs[rev_dir[dir]], 0); else add_var(&GET_TRIG_VARS(t), "direction", "none", 0); @@ -1181,7 +1181,7 @@ int leave_wtrigger(struct room_data *room, char_data *actor, int dir) for (t = TRIGGERS(SCRIPT(room)); t; t = t->next) { if (TRIGGER_CHECK(t, WTRIG_LEAVE) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) { - if (dir>=0 && dir < NUM_OF_DIRS) + if (dir>=0 && dir < DIR_COUNT) add_var(&GET_TRIG_VARS(t), "direction", dirs[dir], 0); else add_var(&GET_TRIG_VARS(t), "direction", "none", 0); @@ -1207,7 +1207,7 @@ int door_wtrigger(char_data *actor, int subcmd, int dir) if (TRIGGER_CHECK(t, WTRIG_DOOR) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) { add_var(&GET_TRIG_VARS(t), "cmd", cmd_door[subcmd], 0); - if (dir>=0 && dir < NUM_OF_DIRS) + if (dir>=0 && dir < DIR_COUNT) add_var(&GET_TRIG_VARS(t), "direction", dirs[dir], 0); else add_var(&GET_TRIG_VARS(t), "direction", "none", 0); diff --git a/src/dg_variables.c b/src/dg_variables.c index 3a59ef9..ad7af20 100644 --- a/src/dg_variables.c +++ b/src/dg_variables.c @@ -506,7 +506,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, } else { doors = 0; room = &world[in_room]; - for (i = 0; i < NUM_OF_DIRS ; i++) + for (i = 0; i < DIR_COUNT ; i++) if (R_EXIT(room, i)) doors++; @@ -514,7 +514,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, *str = '\0'; } else { for ( ; ; ) { - doors = rand_number(0, NUM_OF_DIRS-1); + doors = rand_number(0, DIR_COUNT-1); if (R_EXIT(room, doors)) break; } diff --git a/src/dg_wldcmd.c b/src/dg_wldcmd.c index 94ebd82..d1671d9 100644 --- a/src/dg_wldcmd.c +++ b/src/dg_wldcmd.c @@ -74,8 +74,8 @@ void act_to_room(char *str, room_data *room) if (!room->people) return; - /* Since you can't use act(..., TO_ROOM) for an room, send it TO_ROOM and - * TO_CHAR for some char in the room. (just dont use $n or you might get + /* Since you can't use act(..., TO_ROOM) for an room, send it TO_ROOM and + * TO_CHAR for some char in the room. (just dont use $n or you might get * strange results). */ act(str, FALSE, room->people, 0, 0, TO_ROOM); act(str, FALSE, room->people, 0, 0, TO_CHAR); @@ -94,7 +94,7 @@ WCMD(do_wasound) return; } - for (door = 0; door < NUM_OF_DIRS; door++) { + for (door = 0; door < DIR_COUNT; door++) { struct room_direction_data *newexit; if ((newexit = room->dir_option[door]) && (newexit->to_room != NOWHERE) && @@ -533,20 +533,20 @@ WCMD(do_wdamage) { script_damage(ch, dam); } -WCMD(do_wat) +WCMD(do_wat) { room_rnum loc = NOWHERE; struct char_data *ch; - char arg[MAX_INPUT_LENGTH], *command; + char arg[MAX_INPUT_LENGTH], *command; - command = any_one_arg(argument, arg); + command = any_one_arg(argument, arg); if (!*arg) { wld_log(room, "wat called with no args"); return; } - skip_spaces(&command); + skip_spaces(&command); if (!*command) { wld_log(room, "wat called without a command"); @@ -555,7 +555,7 @@ WCMD(do_wat) if (isdigit(*arg)) loc = real_room(atoi(arg)); else if ((ch = get_char_by_room(room, arg))) loc = IN_ROOM(ch); - + if (loc == NOWHERE) { wld_log(room, "wat: location not found (%s)", arg); return; diff --git a/src/fight.c b/src/fight.c index 1c54fb0..3930c3e 100644 --- a/src/fight.c +++ b/src/fight.c @@ -330,7 +330,7 @@ void death_cry(struct char_data *ch) act("Your blood freezes as you hear $n's death cry.", FALSE, ch, 0, 0, TO_ROOM); - for (door = 0; door < NUM_OF_DIRS; door++) + for (door = 0; door < DIR_COUNT; door++) if (CAN_GO(ch, door)) send_to_room(world[IN_ROOM(ch)].dir_option[door]->to_room, "Your blood freezes as you hear someone's death cry.\r\n"); } diff --git a/src/genolc.c b/src/genolc.c index a80cf4b..880d7fd 100644 --- a/src/genolc.c +++ b/src/genolc.c @@ -423,7 +423,7 @@ static int export_info_file(zone_rnum zrnum) room = &world[rnum]; - for (j = 0; j < NUM_OF_DIRS; j++) { + for (j = 0; j < DIR_COUNT; j++) { if (!R_EXIT(room, j)) continue; @@ -894,7 +894,7 @@ static int export_save_rooms(zone_rnum zrnum) ); /* Now you write out the exits for the room. */ - for (j = 0; j < NUM_OF_DIRS; j++) { + for (j = 0; j < DIR_COUNT; j++) { if (R_EXIT(room, j)) { int dflag; if (R_EXIT(room, j)->general_description) { diff --git a/src/genwld.c b/src/genwld.c index 27e38d8..e392cf6 100644 --- a/src/genwld.c +++ b/src/genwld.c @@ -107,7 +107,7 @@ room_rnum add_room(struct room_data *room) i = top_of_world + 1; do { i--; - for (j = 0; j < NUM_OF_DIRS; j++) + for (j = 0; j < DIR_COUNT; j++) if (W_EXIT(i, j) && W_EXIT(i, j)->to_room != NOWHERE) W_EXIT(i, j)->to_room += (W_EXIT(i, j)->to_room >= found); } while (i > 0); @@ -172,7 +172,7 @@ int delete_room(room_rnum rnum) i = top_of_world + 1; do { i--; - for (j = 0; j < NUM_OF_DIRS; j++) { + for (j = 0; j < NUM_OF_DIRS; j++) { /* NUM_OF_DIRS, not DIR_COUNT */ if (W_EXIT(i, j) == NULL) continue; else if (W_EXIT(i, j)->to_room > rnum) @@ -301,7 +301,7 @@ int save_rooms(zone_rnum rzone) ); /* Now you write out the exits for the room. */ - for (j = 0; j < NUM_OF_DIRS; j++) { + for (j = 0; j < DIR_COUNT; j++) { if (R_EXIT(room, j)) { int dflag; if (R_EXIT(room, j)->general_description) { @@ -316,6 +316,9 @@ int save_rooms(zone_rnum rzone) dflag = 2; else dflag = 1; + + if (IS_SET(R_EXIT(room, j)->exit_info, EX_HIDDEN)) + dflag += 2; } else dflag = 0; @@ -395,7 +398,7 @@ int copy_room_strings(struct room_data *dest, struct room_data *source) dest->description = str_udup(source->description); dest->name = str_udup(source->name); - for (i = 0; i < NUM_OF_DIRS; i++) { + for (i = 0; i < DIR_COUNT; i++) { if (!R_EXIT(source, i)) continue; @@ -426,7 +429,7 @@ int free_room_strings(struct room_data *room) free_ex_descriptions(room->ex_description); /* Free exits. */ - for (i = 0; i < NUM_OF_DIRS; i++) { + for (i = 0; i < NUM_OF_DIRS; i++) { /* NUM_OF_DIRS, not DIR_COUNT */ if (room->dir_option[i]) { if (room->dir_option[i]->general_description) free(room->dir_option[i]->general_description); diff --git a/src/graph.c b/src/graph.c index 00a129e..03e7534 100644 --- a/src/graph.c +++ b/src/graph.c @@ -89,8 +89,8 @@ static void bfs_clear_queue(void) bfs_dequeue(); } -/* find_first_step: given a source room and a target room, find the first step - * on the shortest path from the source to the target. Intended usage: in +/* find_first_step: given a source room and a target room, find the first step + * on the shortest path from the source to the target. Intended usage: in * mobile_activity, give a mob a dir to go if they're tracking another mob or a * PC. Or, a 'track' skill for PCs. */ static int find_first_step(room_rnum src, room_rnum target) @@ -112,7 +112,7 @@ static int find_first_step(room_rnum src, room_rnum target) MARK(src); /* first, enqueue the first steps, saving which direction we're going. */ - for (curr_dir = 0; curr_dir < NUM_OF_DIRS; curr_dir++) + for (curr_dir = 0; curr_dir < DIR_COUNT; curr_dir++) if (VALID_EDGE(src, curr_dir)) { MARK(TOROOM(src, curr_dir)); bfs_enqueue(TOROOM(src, curr_dir), curr_dir); @@ -125,7 +125,7 @@ static int find_first_step(room_rnum src, room_rnum target) bfs_clear_queue(); return (curr_dir); } else { - for (curr_dir = 0; curr_dir < NUM_OF_DIRS; curr_dir++) + for (curr_dir = 0; curr_dir < DIR_COUNT; curr_dir++) if (VALID_EDGE(queue_head->room, curr_dir)) { MARK(TOROOM(queue_head->room, curr_dir)); bfs_enqueue(TOROOM(queue_head->room, curr_dir), queue_head->dir); @@ -170,7 +170,7 @@ ACMD(do_track) int tries = 10; /* Find a random direction. :) */ do { - dir = rand_number(0, NUM_OF_DIRS - 1); + dir = rand_number(0, DIR_COUNT - 1); } while (!CAN_GO(ch, dir) && --tries); send_to_char(ch, "You sense a trail %s from here!\r\n", dirs[dir]); return; diff --git a/src/house.c b/src/house.c index 401b4ad..ffc2794 100644 --- a/src/house.c +++ b/src/house.c @@ -261,7 +261,7 @@ void House_boot(void) if ((real_atrium = real_room(temp_house.atrium)) == NOWHERE) continue; /* house doesn't have an atrium -- skip */ - if (temp_house.exit_num < 0 || temp_house.exit_num >= NUM_OF_DIRS) + if (temp_house.exit_num < 0 || temp_house.exit_num >= DIR_COUNT) continue; /* invalid exit num -- skip */ if (TOROOM(real_house, temp_house.exit_num) != real_atrium) diff --git a/src/interpreter.c b/src/interpreter.c index b5a9e35..af950b9 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -83,6 +83,14 @@ cpp_extern const struct command_info cmd_info[] = { { "west" , "w" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_WEST }, { "up" , "u" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_UP }, { "down" , "d" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_DOWN }, + { "northwest", "northw" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NW }, + { "nw" , "nw" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NW }, + { "northeast", "northe" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NE }, + { "ne" , "ne" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NE }, + { "southeast", "southe" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SE }, + { "se" , "se" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SE }, + { "southwest", "southw" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SW }, + { "sw" , "sw" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SW }, /* now, the main list */ { "at" , "at" , POS_DEAD , do_at , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, diff --git a/src/interpreter.h b/src/interpreter.h index 2787248..31b5de3 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -101,6 +101,10 @@ struct alias_data { #define SCMD_WEST WEST #define SCMD_UP UP #define SCMD_DOWN DOWN +#define SCMD_NW NORTHWEST +#define SCMD_NE NORTHEAST +#define SCMD_SE SOUTHEAST +#define SCMD_SW SOUTHWEST /** @deprecated all old do_poof stuff is deprecated and unused. */ #define SCMD_POOFIN 0 diff --git a/src/mobact.c b/src/mobact.c index 68bbd84..7c5620e 100644 --- a/src/mobact.c +++ b/src/mobact.c @@ -78,11 +78,11 @@ void mobile_activity(void) /* Mob Movement */ if (!MOB_FLAGGED(ch, MOB_SENTINEL) && (GET_POS(ch) == POS_STANDING) && - ((door = rand_number(0, 18)) < NUM_OF_DIRS) && CAN_GO(ch, door) && + ((door = rand_number(0, 18)) < DIR_COUNT) && CAN_GO(ch, door) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_DEATH) && (!MOB_FLAGGED(ch, MOB_STAY_ZONE) || - (world[EXIT(ch, door)->to_room].zone == world[IN_ROOM(ch)].zone))) + (world[EXIT(ch, door)->to_room].zone == world[IN_ROOM(ch)].zone))) { /* If the mob is charmed, do not move the mob. */ if (ch->master == NULL) @@ -136,7 +136,7 @@ void mobile_activity(void) } } - /* Charmed Mob Rebellion: In order to rebel, there need to be more charmed + /* Charmed Mob Rebellion: In order to rebel, there need to be more charmed * monsters than the person can feasibly control at a time. Then the * mobiles have a chance based on the charisma of their leader. * 1-4 = 0, 5-7 = 1, 8-10 = 2, 11-13 = 3, 14-16 = 4, 17-19 = 5, etc. */ @@ -149,13 +149,13 @@ void mobile_activity(void) } /* Helper Mobs */ - if (MOB_FLAGGED(ch, MOB_HELPER) && (!AFF_FLAGGED(ch, AFF_BLIND) || !AFF_FLAGGED(ch, AFF_CHARM))) + if (MOB_FLAGGED(ch, MOB_HELPER) && (!AFF_FLAGGED(ch, AFF_BLIND) || !AFF_FLAGGED(ch, AFF_CHARM))) { found = FALSE; - for (vict = world[IN_ROOM(ch)].people; vict && !found; vict = vict->next_in_room) + for (vict = world[IN_ROOM(ch)].people; vict && !found; vict = vict->next_in_room) { if (ch == vict || !IS_NPC(vict) || !FIGHTING(vict)) - continue; + continue; if (IS_NPC(FIGHTING(vict)) || ch == FIGHTING(vict)) continue; @@ -232,8 +232,8 @@ void clearMemory(struct char_data *ch) MEMORY(ch) = NULL; } -/* An aggressive mobile wants to attack something. If they're under the - * influence of mind altering PC, then see if their master can talk them out +/* An aggressive mobile wants to attack something. If they're under the + * influence of mind altering PC, then see if their master can talk them out * of it, eye them down, or otherwise intimidate the slave. */ static bool aggressive_mob_on_a_leash(struct char_data *slave, struct char_data *master, struct char_data *attack) { diff --git a/src/oasis_delete.c b/src/oasis_delete.c index 2e90a31..e857b18 100644 --- a/src/oasis_delete.c +++ b/src/oasis_delete.c @@ -47,7 +47,7 @@ int free_strings(void *data, int type) case OASIS_EXI: room = (struct room_data *) data; - for (i = 0; i < NUM_OF_DIRS; i++) { + for (i = 0; i < NUM_OF_DIRS; i++) { /* NUM_OF_DIRS, not DIR_COUNT */ if (room->dir_option[i]) { if (room->dir_option[i]->general_description) { free(room->dir_option[i]->general_description); diff --git a/src/oasis_list.c b/src/oasis_list.c index 6dde1f0..4e4d886 100644 --- a/src/oasis_list.c +++ b/src/oasis_list.c @@ -209,7 +209,7 @@ ACMD(do_oasis_links) send_to_char(ch, "Zone %d is linked to the following zones:\r\n", zvnum); for (nr = 0; nr <= top_of_world && (GET_ROOM_VNUM(nr) <= last); nr++) { if (GET_ROOM_VNUM(nr) >= first) { - for (j = 0; j < NUM_OF_DIRS; j++) { + for (j = 0; j < DIR_COUNT; j++) { if (world[nr].dir_option[j]) { to_room = world[nr].dir_option[j]->to_room; if (to_room != NOWHERE && (zrnum != world[to_room].zone)) @@ -259,7 +259,7 @@ static void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, roo world[i].proto_script ? "[TRIG] " : "" ); - for (j = 0; j < NUM_OF_DIRS; j++) { + for (j = 0; j < DIR_COUNT; j++) { if (W_EXIT(i, j) == NULL) continue; if (W_EXIT(i, j)->to_room == NOWHERE) diff --git a/src/redit.c b/src/redit.c index dc4f49f..93a1752 100644 --- a/src/redit.c +++ b/src/redit.c @@ -182,7 +182,7 @@ void redit_setup_existing(struct descriptor_data *d, int real_num) room->description = str_udup(world[real_num].description); /* Exits - We allocate only if necessary. */ - for (counter = 0; counter < NUM_OF_DIRS; counter++) { + for (counter = 0; counter < DIR_COUNT; counter++) { if (world[real_num].dir_option[counter]) { CREATE(room->dir_option[counter], struct room_direction_data, 1); @@ -277,7 +277,7 @@ void redit_save_internally(struct descriptor_data *d) break; } } else if (STATE(dsc) == CON_REDIT) { - for (j = 0; j < NUM_OF_DIRS; j++) + for (j = 0; j < DIR_COUNT; j++) if (OLC_ROOM(dsc)->dir_option[j]) if (OLC_ROOM(dsc)->dir_option[j]->to_room >= room_num) OLC_ROOM(dsc)->dir_option[j]->to_room++; @@ -336,8 +336,12 @@ static void redit_disp_exit_menu(struct descriptor_data *d) } /* Weird door handling! */ if (IS_SET(OLC_EXIT(d)->exit_info, EX_ISDOOR)) { - if (IS_SET(OLC_EXIT(d)->exit_info, EX_PICKPROOF)) + if (IS_SET(OLC_EXIT(d)->exit_info, EX_PICKPROOF) && IS_SET(OLC_EXIT(d)->exit_info, EX_HIDDEN)) + strncpy(door_buf, "Hidden Pickproof", sizeof(door_buf)-1); + else if (IS_SET(OLC_EXIT(d)->exit_info, EX_PICKPROOF)) strncpy(door_buf, "Pickproof", sizeof(door_buf)-1); + else if (IS_SET(OLC_EXIT(d)->exit_info, EX_HIDDEN)) + strncpy(door_buf, "Is a Hidden Door", sizeof(door_buf)-1); else strncpy(door_buf, "Is a door", sizeof(door_buf)-1); } else @@ -370,8 +374,10 @@ static void redit_disp_exit_flag_menu(struct descriptor_data *d) get_char_colors(d->character); write_to_output(d, "%s0%s) No door\r\n" "%s1%s) Closeable door\r\n" - "%s2%s) Pickproof\r\n" - "Enter choice : ", grn, nrm, grn, nrm, grn, nrm); + "%s2%s) Pickproof Door\r\n" + "%s3%s) Hidden Door\r\n" + "%s4%s) Hidden, Pickproof Door\r\n" + "Enter choice : ", grn, nrm, grn, nrm, grn, nrm, grn, nrm, grn, nrm); } /* For room flags. */ @@ -416,26 +422,21 @@ static void redit_disp_menu(struct descriptor_data *d) "%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) Extra descriptions menu\r\n" - "%sS%s) Script : %s%s\r\n" - "%sW%s) Copy Room\r\n" - "%sX%s) Delete Room\r\n" - "%sQ%s) Quit\r\n" - "Enter choice : ", - + "%s4%s) Sector type : %s%s\r\n", cyn, OLC_NUM(d), nrm, cyn, zone_table[OLC_ZNUM(d)].number, nrm, grn, nrm, yel, room->name, grn, nrm, yel, room->description, grn, nrm, cyn, buf1, - grn, nrm, cyn, buf2, + grn, nrm, cyn, buf2); + + if (!CONFIG_DIAGONAL_DIRS) + { + write_to_output(d, + "%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", grn, nrm, cyn, room->dir_option[NORTH] && room->dir_option[NORTH]->to_room != NOWHERE ? world[room->dir_option[NORTH]->to_room].number : -1, @@ -447,7 +448,48 @@ static void redit_disp_menu(struct descriptor_data *d) world[room->dir_option[SOUTH]->to_room].number : -1, grn, nrm, cyn, room->dir_option[WEST] && room->dir_option[WEST]->to_room != NOWHERE ? - world[room->dir_option[WEST]->to_room].number : -1, + world[room->dir_option[WEST]->to_room].number : -1); + } else { + write_to_output(d, + "%s5%s) Exit north : %s%d%s, %sB%s) Exit northwest : %s%d\r\n" + "%s6%s) Exit east : %s%d%s, %sC%s) Exit northeast : %s%d\r\n" + "%s7%s) Exit south : %s%d%s, %sD%s) Exit southeast : %s%d\r\n" + "%s8%s) Exit west : %s%d%s, %sE%s) Exit southwest : %s%d\r\n", + grn, nrm, cyn, + room->dir_option[NORTH] && room->dir_option[NORTH]->to_room != NOWHERE ? + world[room->dir_option[NORTH]->to_room].number : -1, nrm, + grn, nrm, cyn, + room->dir_option[NORTHWEST] && room->dir_option[NORTHWEST]->to_room != NOWHERE ? + world[room->dir_option[NORTHWEST]->to_room].number : -1, + grn, nrm, cyn, + room->dir_option[EAST] && room->dir_option[EAST]->to_room != NOWHERE ? + world[room->dir_option[EAST]->to_room].number : -1, nrm, + grn, nrm, cyn, + room->dir_option[NORTHEAST] && room->dir_option[NORTHEAST]->to_room != NOWHERE ? + world[room->dir_option[NORTHEAST]->to_room].number : -1, + grn, nrm, cyn, + room->dir_option[SOUTH] && room->dir_option[SOUTH]->to_room != NOWHERE ? + world[room->dir_option[SOUTH]->to_room].number : -1, nrm, + grn, nrm, cyn, + room->dir_option[SOUTHEAST] && room->dir_option[SOUTHEAST]->to_room != NOWHERE ? + world[room->dir_option[SOUTHEAST]->to_room].number : -1, + grn, nrm, cyn, + room->dir_option[WEST] && room->dir_option[WEST]->to_room != NOWHERE ? + world[room->dir_option[WEST]->to_room].number : -1, nrm, + grn, nrm, cyn, + room->dir_option[SOUTHWEST] && room->dir_option[SOUTHWEST]->to_room != NOWHERE ? + world[room->dir_option[SOUTHWEST]->to_room].number : -1 + ); + } + write_to_output(d, + "%s9%s) Exit up : %s%d\r\n" + "%sA%s) Exit down : %s%d\r\n" + "%sF%s) Extra descriptions menu\r\n" + "%sS%s) Script : %s%s\r\n" + "%sW%s) Copy Room\r\n" + "%sX%s) Delete Room\r\n" + "%sQ%s) Quit\r\n" + "Enter choice : ", grn, nrm, cyn, room->dir_option[UP] && room->dir_option[UP]->to_room != NOWHERE ? world[room->dir_option[UP]->to_room].number : -1, @@ -559,6 +601,46 @@ void redit_parse(struct descriptor_data *d, char *arg) break; case 'b': case 'B': + if (CONFIG_DIAGONAL_DIRS) { + write_to_output(d, "Invalid choice!"); + redit_disp_menu(d); + } else { + OLC_VAL(d) = NORTHWEST; + redit_disp_exit_menu(d); + } + break; + case 'c': + case 'C': + if (CONFIG_DIAGONAL_DIRS) { + write_to_output(d, "Invalid choice!"); + redit_disp_menu(d); + } else { + OLC_VAL(d) = NORTHEAST; + redit_disp_exit_menu(d); + } + break; + case 'd': + case 'D': + if (CONFIG_DIAGONAL_DIRS) { + write_to_output(d, "Invalid choice!"); + redit_disp_menu(d); + } else { + OLC_VAL(d) = SOUTHEAST; + redit_disp_exit_menu(d); + } + break; + case 'e': + case 'E': + if (CONFIG_DIAGONAL_DIRS) { + write_to_output(d, "Invalid choice!"); + redit_disp_menu(d); + } else { + OLC_VAL(d) = SOUTHWEST; + redit_disp_exit_menu(d); + } + break; + case 'f': + case 'F': /* If the extra description doesn't exist. */ if (!OLC_ROOM(d)->ex_description) CREATE(OLC_ROOM(d)->ex_description, struct extra_descr_data, 1); @@ -721,8 +803,10 @@ void redit_parse(struct descriptor_data *d, char *arg) } else { /* Doors are a bit idiotic, don't you think? :) -- I agree. -gg */ OLC_EXIT(d)->exit_info = (number == 0 ? 0 : - (number == 1 ? EX_ISDOOR : - (number == 2 ? EX_ISDOOR | EX_PICKPROOF : 0))); + (number == 1 ? EX_ISDOOR : + (number == 2 ? EX_ISDOOR | EX_PICKPROOF : + (number == 3 ? EX_ISDOOR | EX_HIDDEN : + (number == 4 ? EX_ISDOOR | EX_PICKPROOF | EX_HIDDEN : 0))))); /* Jump back to the menu system. */ redit_disp_exit_menu(d); } diff --git a/src/spec_procs.c b/src/spec_procs.c index 5f2dfef..1083e24 100644 --- a/src/spec_procs.c +++ b/src/spec_procs.c @@ -433,8 +433,9 @@ SPECIAL(guild_guard) return (FALSE); /* find out what direction they are trying to go */ - for (direction = 0; direction < NUM_OF_DIRS; direction++) - if (!strcmp(cmd_info[cmd].command, dirs[direction])) + for (direction = 0; direction < DIR_COUNT; direction++) + if (!strcmp(cmd_info[cmd].command, dirs[direction]) || + !strcmp(cmd_info[cmd].command, autoexits[direction])) break; for (i = 0; guild_info[i].guild_room != NOWHERE; i++) { diff --git a/src/structs.h b/src/structs.h index 2259024..9185c71 100644 --- a/src/structs.h +++ b/src/structs.h @@ -64,10 +64,14 @@ #define WEST 3 /**< The direction west */ #define UP 4 /**< The direction up */ #define DOWN 5 /**< The direction down */ +#define NORTHWEST 6 /**< The direction north-west */ +#define NORTHEAST 7 /**< The direction north-east */ +#define SOUTHEAST 8 /**< The direction south-east */ +#define SOUTHWEST 9 /**< The direction south-west */ /** Total number of directions available to move in. BEFORE CHANGING THIS, make * sure you change every other direction and movement based item that this will * impact. */ -#define NUM_OF_DIRS 6 +#define NUM_OF_DIRS 10 /* Room flags: used in room_data.room_flags */ /* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */ @@ -102,11 +106,11 @@ #define NUM_ZONE_FLAGS 6 /* Exit info: used in room_data.dir_option.exit_info */ -#define EX_ISDOOR (1 << 0) /**< Exit is a door */ -#define EX_CLOSED (1 << 1) /**< The door is closed */ -#define EX_LOCKED (1 << 2) /**< The door is locked */ -#define EX_PICKPROOF (1 << 3) /**< Lock can't be picked */ -#define EX_HIDDEN (1 << 4) /**< Exit is hidden */ +#define EX_ISDOOR (1 << 0) /**< Exit is a door */ +#define EX_CLOSED (1 << 1) /**< The door is closed */ +#define EX_LOCKED (1 << 2) /**< The door is locked */ +#define EX_PICKPROOF (1 << 3) /**< Lock can't be picked */ +#define EX_HIDDEN (1 << 4) /**< Exit is hidden, secret */ /* Sector types: used in room_data.sector_type */ #define SECT_INSIDE 0 /**< Indoors, connected to SECT macro. */ @@ -1314,6 +1318,7 @@ struct game_data int track_through_doors; /**< Track through doors while closed? */ int no_mort_to_immort; /**< Prevent mortals leveling to imms? */ int disp_closed_doors; /**< Display closed doors in autoexit? */ + int diagonal_dirs; /**< Are there 6 or 10 directions? */ int map_option; /**< MAP_ON, MAP_OFF or MAP_IMM_ONLY */ int map_size; /**< Default size for map command */ int minimap_size; /**< Default size for mini-map (automap) */ diff --git a/src/utils.h b/src/utils.h index d63b52e..baa70a1 100644 --- a/src/utils.h +++ b/src/utils.h @@ -850,6 +850,13 @@ do \ (EXIT(ch,door)->to_room != NOWHERE) && \ !IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED)) +/** True total number of directions available to move in. */ +#define DIR_COUNT ((CONFIG_DIAGONAL_DIRS) ? 10 : 6) + +/* Returns TRUE if the direction is a diagonal one */ +#define IS_DIAGONAL(dir) (((dir) == NORTHWEST) || ((dir) == NORTHEAST) || \ + ((dir) == SOUTHEAST) || ((dir) == SOUTHWEST) ) + /** Return the class abbreviation for ch. */ #define CLASS_ABBR(ch) (IS_NPC(ch) ? "--" : class_abbrevs[(int)GET_CLASS(ch)]) @@ -977,6 +984,8 @@ do \ #define CONFIG_NOEFFECT config_info.play.NOEFFECT /** Get the display closed doors setting. */ #define CONFIG_DISP_CLOSED_DOORS config_info.play.disp_closed_doors +/** Get the diagonal directions setting. */ +#define CONFIG_DIAGONAL_DIRS config_info.play.diagonal_dirs /* Map/Automap options */ #define CONFIG_MAP config_info.play.map_option diff --git a/src/zedit.c b/src/zedit.c index ec804e1..83e353c 100644 --- a/src/zedit.c +++ b/src/zedit.c @@ -1055,7 +1055,7 @@ void zedit_parse(struct descriptor_data *d, char *arg) case 'D': pos = atoi(arg); /* Count directions. */ - if (pos < 0 || pos > NUM_OF_DIRS) + if (pos < 0 || pos > DIR_COUNT) write_to_output(d, "Try again : "); else { OLC_CMD(d).arg2 = pos;