From e6085172d546eab32a80ccdbe4f1f8385d3a6aa1 Mon Sep 17 00:00:00 2001 From: welcor <357770+welcor@users.noreply.github.com> Date: Tue, 17 Sep 2024 01:04:36 +0200 Subject: [PATCH] KAIZEN formatting and linting, header files --- src/aedit.c | 1294 ++++++++++---------- src/ban.h | 22 +- src/boards.h | 42 +- src/bsd-snprintf.h | 4 +- src/class.h | 10 +- src/comm.h | 30 +- src/db.h | 275 +++-- src/dg_event.h | 32 +- src/dg_olc.h | 48 +- src/dg_scripts.h | 142 +-- src/fight.h | 15 +- src/genmob.h | 20 +- src/genobj.h | 6 +- src/genolc.h | 34 +- src/genshp.h | 62 +- src/genwld.h | 6 +- src/genzon.h | 6 +- src/graph.h | 10 +- src/handler.h | 86 +- src/hedit.h | 6 +- src/house.h | 63 +- src/ibt.h | 25 +- src/improved-edit.h | 26 +- src/interpreter.c | 2801 ++++++++++++++++++++++--------------------- src/interpreter.h | 68 +- src/lists.h | 24 +- src/mail.h | 71 +- src/modify.h | 14 +- src/msgedit.h | 8 +- src/mud_event.h | 22 +- src/oasis.h | 484 ++++---- src/pfdefaults.h | 100 +- src/prefedit.h | 13 +- src/protocol.h | 409 ++++--- src/quest.c | 1248 +++++++++---------- src/quest.h | 36 +- src/screen.h | 302 ++--- src/shop.h | 184 +-- src/spec_procs.h | 16 +- src/spells.h | 111 +- src/structs.h | 1229 +++++++++---------- src/sysdep.h | 202 ++-- src/telnet.h | 395 +++--- src/utils.h | 374 +++--- src/zmalloc.h | 16 +- 45 files changed, 5153 insertions(+), 5238 deletions(-) mode change 100755 => 100644 src/ibt.h mode change 100755 => 100644 src/prefedit.h diff --git a/src/aedit.c b/src/aedit.c index 5310c22..cdab1d4 100644 --- a/src/aedit.c +++ b/src/aedit.c @@ -34,788 +34,816 @@ static void aedit_save_internally(struct descriptor_data *d); /* Utils and exported functions. */ ACMD(do_oasis_aedit) { - char arg[MAX_INPUT_LENGTH]; - struct descriptor_data *d; - int i; + char arg[MAX_INPUT_LENGTH]; + struct descriptor_data *d; + int i; - /* No building as a mob or while being forced. */ - if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING) - return; - - if (CONFIG_NEW_SOCIALS == 0) { - send_to_char(ch, "Socials cannot be edited at the moment.\r\n"); - return; - } + /* No building as a mob or while being forced. */ + if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING) + return; - if (!can_edit_zone(ch, AEDIT_PERMISSION)) { - send_to_char(ch, "You don't have access to editing socials.\r\n"); - return; - } - - for (d = descriptor_list; d; d = d->next) - if (STATE(d) == CON_AEDIT) { - send_to_char(ch, "Sorry, only one can edit socials at a time.\r\n"); - return; + if (CONFIG_NEW_SOCIALS == 0) { + send_to_char(ch, "Socials cannot be edited at the moment.\r\n"); + return; } - one_argument(argument, arg); - - if (!*arg) { - send_to_char(ch, "Please specify a social to edit.\r\n"); - return; - } - - d = ch->desc; - - if (!str_cmp("save", arg)) { - mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "OLC: %s saves socials.", GET_NAME(ch)); - send_to_char(ch, "Writing social file.\r\n"); - aedit_save_to_disk(d); - send_to_char(ch, "Done.\r\n"); - return; - } - - /* Give descriptor an OLC structure. */ - if (d->olc) { - mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis: Player already had olc structure."); - free(d->olc); - } - CREATE(d->olc, struct oasis_olc_data, 1); - - OLC_NUM(d) = 0; - OLC_STORAGE(d) = strdup(arg); - - for (OLC_ZNUM(d) = 0; (OLC_ZNUM(d) <= top_of_socialt); OLC_ZNUM(d)++) - if (is_abbrev(OLC_STORAGE(d), soc_mess_list[OLC_ZNUM(d)].command)) - break; - - if (OLC_ZNUM(d) > top_of_socialt) { - if ((i = aedit_find_command(OLC_STORAGE(d))) != -1) { - send_to_char(ch, "The '%s' command already exists (%s).\r\n", OLC_STORAGE(d), complete_cmd_info[i].command); - cleanup_olc(d, CLEANUP_ALL); - return; + if (!can_edit_zone(ch, AEDIT_PERMISSION)) { + send_to_char(ch, "You don't have access to editing socials.\r\n"); + return; } - send_to_char(ch, "Do you wish to add the '%s' action? ", OLC_STORAGE(d)); - OLC_MODE(d) = AEDIT_CONFIRM_ADD; - } else { - send_to_char(ch, "Do you wish to edit the '%s' action? ", soc_mess_list[OLC_ZNUM(d)].command); - OLC_MODE(d) = AEDIT_CONFIRM_EDIT; - } - STATE(d) = CON_AEDIT; - act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM); - SET_BIT_AR(PLR_FLAGS(ch), PLR_WRITING); - mudlog(CMP, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "OLC: %s starts editing actions.", GET_NAME(ch)); + + for (d = descriptor_list; d; d = d->next) + if (STATE(d) == CON_AEDIT) { + send_to_char(ch, "Sorry, only one can edit socials at a time.\r\n"); + return; + } + + one_argument(argument, arg); + + if (!*arg) { + send_to_char(ch, "Please specify a social to edit.\r\n"); + return; + } + + d = ch->desc; + + if (!str_cmp("save", arg)) { + mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "OLC: %s saves socials.", GET_NAME(ch)); + send_to_char(ch, "Writing social file.\r\n"); + aedit_save_to_disk(d); + send_to_char(ch, "Done.\r\n"); + return; + } + + /* Give descriptor an OLC structure. */ + if (d->olc) { + mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis: Player already had olc structure."); + free(d->olc); + } + CREATE(d->olc, struct oasis_olc_data, 1); + + OLC_NUM(d) = 0; + OLC_STORAGE(d) = strdup(arg); + + for (OLC_ZNUM(d) = 0; (OLC_ZNUM(d) <= top_of_socialt); OLC_ZNUM(d)++) + if (is_abbrev(OLC_STORAGE(d), soc_mess_list[OLC_ZNUM(d)].command)) + break; + + if (OLC_ZNUM(d) > top_of_socialt) { + if ((i = aedit_find_command(OLC_STORAGE(d))) != -1) { + send_to_char(ch, "The '%s' command already exists (%s).\r\n", OLC_STORAGE(d), complete_cmd_info[i].command); + cleanup_olc(d, CLEANUP_ALL); + return; + } + send_to_char(ch, "Do you wish to add the '%s' action? ", OLC_STORAGE(d)); + OLC_MODE(d) = AEDIT_CONFIRM_ADD; + } else { + send_to_char(ch, "Do you wish to edit the '%s' action? ", soc_mess_list[OLC_ZNUM(d)].command); + OLC_MODE(d) = AEDIT_CONFIRM_EDIT; + } + STATE(d) = CON_AEDIT; + act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM); + SET_BIT_AR(PLR_FLAGS(ch), PLR_WRITING); + mudlog(CMP, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "OLC: %s starts editing actions.", GET_NAME(ch)); } -static void aedit_setup_new(struct descriptor_data *d) { - CREATE(OLC_ACTION(d), struct social_messg, 1); - OLC_ACTION(d)->command = strdup(OLC_STORAGE(d)); - OLC_ACTION(d)->sort_as = strdup(OLC_STORAGE(d)); - OLC_ACTION(d)->hide = 0; - OLC_ACTION(d)->min_victim_position = POS_STANDING; - OLC_ACTION(d)->min_char_position = POS_STANDING; - OLC_ACTION(d)->min_level_char = 0; - OLC_ACTION(d)->char_no_arg = strdup("This action is unfinished."); - OLC_ACTION(d)->others_no_arg = strdup("This action is unfinished."); - OLC_ACTION(d)->char_found = NULL; - OLC_ACTION(d)->others_found = NULL; - OLC_ACTION(d)->vict_found = NULL; - OLC_ACTION(d)->not_found = NULL; - OLC_ACTION(d)->char_auto = NULL; - OLC_ACTION(d)->others_auto = NULL; - OLC_ACTION(d)->char_body_found = NULL; - OLC_ACTION(d)->others_body_found = NULL; - OLC_ACTION(d)->vict_body_found = NULL; - OLC_ACTION(d)->char_obj_found = NULL; - OLC_ACTION(d)->others_obj_found = NULL; - aedit_disp_menu(d); - OLC_VAL(d) = 0; +static void aedit_setup_new(struct descriptor_data *d) +{ + CREATE(OLC_ACTION(d), struct social_messg, 1); + OLC_ACTION(d)->command = strdup(OLC_STORAGE(d)); + OLC_ACTION(d)->sort_as = strdup(OLC_STORAGE(d)); + OLC_ACTION(d)->hide = 0; + OLC_ACTION(d)->min_victim_position = POS_STANDING; + OLC_ACTION(d)->min_char_position = POS_STANDING; + OLC_ACTION(d)->min_level_char = 0; + OLC_ACTION(d)->char_no_arg = strdup("This action is unfinished."); + OLC_ACTION(d)->others_no_arg = strdup("This action is unfinished."); + OLC_ACTION(d)->char_found = NULL; + OLC_ACTION(d)->others_found = NULL; + OLC_ACTION(d)->vict_found = NULL; + OLC_ACTION(d)->not_found = NULL; + OLC_ACTION(d)->char_auto = NULL; + OLC_ACTION(d)->others_auto = NULL; + OLC_ACTION(d)->char_body_found = NULL; + OLC_ACTION(d)->others_body_found = NULL; + OLC_ACTION(d)->vict_body_found = NULL; + OLC_ACTION(d)->char_obj_found = NULL; + OLC_ACTION(d)->others_obj_found = NULL; + aedit_disp_menu(d); + OLC_VAL(d) = 0; } -static void aedit_setup_existing(struct descriptor_data *d, int real_num) { - CREATE(OLC_ACTION(d), struct social_messg, 1); - OLC_ACTION(d)->command = strdup(soc_mess_list[real_num].command); - OLC_ACTION(d)->sort_as = strdup(soc_mess_list[real_num].sort_as); - OLC_ACTION(d)->hide = soc_mess_list[real_num].hide; - OLC_ACTION(d)->min_victim_position = soc_mess_list[real_num].min_victim_position; - OLC_ACTION(d)->min_char_position = soc_mess_list[real_num].min_char_position; - OLC_ACTION(d)->min_level_char = soc_mess_list[real_num].min_level_char; - if (soc_mess_list[real_num].char_no_arg) - OLC_ACTION(d)->char_no_arg = strdup(soc_mess_list[real_num].char_no_arg); - if (soc_mess_list[real_num].others_no_arg) - OLC_ACTION(d)->others_no_arg = strdup(soc_mess_list[real_num].others_no_arg); - if (soc_mess_list[real_num].char_found) - OLC_ACTION(d)->char_found = strdup(soc_mess_list[real_num].char_found); - if (soc_mess_list[real_num].others_found) - OLC_ACTION(d)->others_found = strdup(soc_mess_list[real_num].others_found); - if (soc_mess_list[real_num].vict_found) - OLC_ACTION(d)->vict_found = strdup(soc_mess_list[real_num].vict_found); - if (soc_mess_list[real_num].not_found) - OLC_ACTION(d)->not_found = strdup(soc_mess_list[real_num].not_found); - if (soc_mess_list[real_num].char_auto) - OLC_ACTION(d)->char_auto = strdup(soc_mess_list[real_num].char_auto); - if (soc_mess_list[real_num].others_auto) - OLC_ACTION(d)->others_auto = strdup(soc_mess_list[real_num].others_auto); - if (soc_mess_list[real_num].char_body_found) - OLC_ACTION(d)->char_body_found = strdup(soc_mess_list[real_num].char_body_found); - if (soc_mess_list[real_num].others_body_found) - OLC_ACTION(d)->others_body_found = strdup(soc_mess_list[real_num].others_body_found); - if (soc_mess_list[real_num].vict_body_found) - OLC_ACTION(d)->vict_body_found = strdup(soc_mess_list[real_num].vict_body_found); - if (soc_mess_list[real_num].char_obj_found) - OLC_ACTION(d)->char_obj_found = strdup(soc_mess_list[real_num].char_obj_found); - if (soc_mess_list[real_num].others_obj_found) - OLC_ACTION(d)->others_obj_found = strdup(soc_mess_list[real_num].others_obj_found); - OLC_VAL(d) = 0; - aedit_disp_menu(d); +static void aedit_setup_existing(struct descriptor_data *d, int real_num) +{ + CREATE(OLC_ACTION(d), struct social_messg, 1); + OLC_ACTION(d)->command = strdup(soc_mess_list[real_num].command); + OLC_ACTION(d)->sort_as = strdup(soc_mess_list[real_num].sort_as); + OLC_ACTION(d)->hide = soc_mess_list[real_num].hide; + OLC_ACTION(d)->min_victim_position = soc_mess_list[real_num].min_victim_position; + OLC_ACTION(d)->min_char_position = soc_mess_list[real_num].min_char_position; + OLC_ACTION(d)->min_level_char = soc_mess_list[real_num].min_level_char; + if (soc_mess_list[real_num].char_no_arg) + OLC_ACTION(d)->char_no_arg = strdup(soc_mess_list[real_num].char_no_arg); + if (soc_mess_list[real_num].others_no_arg) + OLC_ACTION(d)->others_no_arg = strdup(soc_mess_list[real_num].others_no_arg); + if (soc_mess_list[real_num].char_found) + OLC_ACTION(d)->char_found = strdup(soc_mess_list[real_num].char_found); + if (soc_mess_list[real_num].others_found) + OLC_ACTION(d)->others_found = strdup(soc_mess_list[real_num].others_found); + if (soc_mess_list[real_num].vict_found) + OLC_ACTION(d)->vict_found = strdup(soc_mess_list[real_num].vict_found); + if (soc_mess_list[real_num].not_found) + OLC_ACTION(d)->not_found = strdup(soc_mess_list[real_num].not_found); + if (soc_mess_list[real_num].char_auto) + OLC_ACTION(d)->char_auto = strdup(soc_mess_list[real_num].char_auto); + if (soc_mess_list[real_num].others_auto) + OLC_ACTION(d)->others_auto = strdup(soc_mess_list[real_num].others_auto); + if (soc_mess_list[real_num].char_body_found) + OLC_ACTION(d)->char_body_found = strdup(soc_mess_list[real_num].char_body_found); + if (soc_mess_list[real_num].others_body_found) + OLC_ACTION(d)->others_body_found = strdup(soc_mess_list[real_num].others_body_found); + if (soc_mess_list[real_num].vict_body_found) + OLC_ACTION(d)->vict_body_found = strdup(soc_mess_list[real_num].vict_body_found); + if (soc_mess_list[real_num].char_obj_found) + OLC_ACTION(d)->char_obj_found = strdup(soc_mess_list[real_num].char_obj_found); + if (soc_mess_list[real_num].others_obj_found) + OLC_ACTION(d)->others_obj_found = strdup(soc_mess_list[real_num].others_obj_found); + OLC_VAL(d) = 0; + aedit_disp_menu(d); } -static void aedit_save_internally(struct descriptor_data *d) { - struct social_messg *new_soc_mess_list = NULL; - int i; +static void aedit_save_internally(struct descriptor_data *d) +{ + struct social_messg *new_soc_mess_list = NULL; + int i; - /* add a new social into the list */ - if (OLC_ZNUM(d) > top_of_socialt) { - CREATE(new_soc_mess_list, struct social_messg, top_of_socialt + 2); - for (i = 0; i <= top_of_socialt; i++) - new_soc_mess_list[i] = soc_mess_list[i]; - new_soc_mess_list[++top_of_socialt] = *OLC_ACTION(d); - free(soc_mess_list); - soc_mess_list = new_soc_mess_list; - } - /* pass the editted action back to the list - no need to add */ - else { - aedit_find_command(OLC_ACTION(d)->command); - OLC_ACTION(d)->act_nr = soc_mess_list[OLC_ZNUM(d)].act_nr; - /* why did i do this..? hrm */ - free_action(soc_mess_list + OLC_ZNUM(d)); - soc_mess_list[OLC_ZNUM(d)] = *OLC_ACTION(d); - } + /* add a new social into the list */ + if (OLC_ZNUM(d) > top_of_socialt) { + CREATE(new_soc_mess_list, struct social_messg, top_of_socialt + 2); + for (i = 0; i <= top_of_socialt; i++) + new_soc_mess_list[i] = soc_mess_list[i]; + new_soc_mess_list[++top_of_socialt] = *OLC_ACTION(d); + free(soc_mess_list); + soc_mess_list = new_soc_mess_list; + } + /* pass the editted action back to the list - no need to add */ + else { + aedit_find_command(OLC_ACTION(d)->command); + OLC_ACTION(d)->act_nr = soc_mess_list[OLC_ZNUM(d)].act_nr; + /* why did i do this..? hrm */ + free_action(soc_mess_list + OLC_ZNUM(d)); + soc_mess_list[OLC_ZNUM(d)] = *OLC_ACTION(d); + } - create_command_list(); - /* aedit patch -- M. Scott */ - sort_commands(); + create_command_list(); + /* aedit patch -- M. Scott */ + sort_commands(); - add_to_save_list(AEDIT_PERMISSION, SL_ACT); - aedit_save_to_disk(d); /* autosave by Rumble */ + add_to_save_list(AEDIT_PERMISSION, SL_ACT); + aedit_save_to_disk(d); /* autosave by Rumble */ } -static void aedit_save_to_disk(struct descriptor_data *d) { - FILE *fp; - int i; - char buf[MAX_STRING_LENGTH]; - if (!(fp = fopen(SOCMESS_FILE_NEW, "w+"))) { - char error[MAX_STRING_LENGTH]; - snprintf(error, sizeof(error), "Can't open socials file '%s'", SOCMESS_FILE); - perror(error); - exit(1); - } +static void aedit_save_to_disk(struct descriptor_data *d) +{ + FILE *fp; + int i; + char buf[MAX_STRING_LENGTH]; + if (!(fp = fopen(SOCMESS_FILE_NEW, "w+"))) { + char error[MAX_STRING_LENGTH]; + snprintf(error, sizeof(error), "Can't open socials file '%s'", SOCMESS_FILE); + perror(error); + exit(1); + } - for (i = 0; i <= top_of_socialt; i++) { - fprintf(fp, "~%s %s %d %d %d %d\n", - soc_mess_list[i].command, - soc_mess_list[i].sort_as, - soc_mess_list[i].hide, - soc_mess_list[i].min_char_position, - soc_mess_list[i].min_victim_position, - soc_mess_list[i].min_level_char); - - sprintf(buf, "%s\n%s\n%s\n%s\n", - ((soc_mess_list[i].char_no_arg)?soc_mess_list[i].char_no_arg:"#"), - ((soc_mess_list[i].others_no_arg)?soc_mess_list[i].others_no_arg:"#"), - ((soc_mess_list[i].char_found)?soc_mess_list[i].char_found:"#"), - ((soc_mess_list[i].others_found)?soc_mess_list[i].others_found:"#")); - fprintf(fp, "%s", convert_from_tabs(buf)); - - sprintf(buf, "%s\n%s\n%s\n%s\n", - ((soc_mess_list[i].vict_found)?soc_mess_list[i].vict_found:"#"), - ((soc_mess_list[i].not_found)?soc_mess_list[i].not_found:"#"), - ((soc_mess_list[i].char_auto)?soc_mess_list[i].char_auto:"#"), - ((soc_mess_list[i].others_auto)?soc_mess_list[i].others_auto:"#")); - fprintf(fp, "%s", convert_from_tabs(buf)); - - sprintf(buf, "%s\n%s\n%s\n", - ((soc_mess_list[i].char_body_found)?soc_mess_list[i].char_body_found:"#"), - ((soc_mess_list[i].others_body_found)?soc_mess_list[i].others_body_found:"#"), - ((soc_mess_list[i].vict_body_found)?soc_mess_list[i].vict_body_found:"#")); - fprintf(fp, "%s", convert_from_tabs(buf)); - - sprintf(buf, "%s\n%s\n\n", - ((soc_mess_list[i].char_obj_found)?soc_mess_list[i].char_obj_found:"#"), - ((soc_mess_list[i].others_obj_found)?soc_mess_list[i].others_obj_found:"#")); - fprintf(fp, "%s", convert_from_tabs(buf)); - } + for (i = 0; i <= top_of_socialt; i++) { + fprintf(fp, "~%s %s %d %d %d %d\n", + soc_mess_list[i].command, + soc_mess_list[i].sort_as, + soc_mess_list[i].hide, + soc_mess_list[i].min_char_position, + soc_mess_list[i].min_victim_position, + soc_mess_list[i].min_level_char); - fprintf(fp, "$\n"); - fclose(fp); - remove_from_save_list(AEDIT_PERMISSION, SL_ACT); + sprintf(buf, "%s\n%s\n%s\n%s\n", + ((soc_mess_list[i].char_no_arg)?soc_mess_list[i].char_no_arg:"#"), + ((soc_mess_list[i].others_no_arg)?soc_mess_list[i].others_no_arg:"#"), + ((soc_mess_list[i].char_found)?soc_mess_list[i].char_found:"#"), + ((soc_mess_list[i].others_found)?soc_mess_list[i].others_found:"#")); + fprintf(fp, "%s", convert_from_tabs(buf)); + + sprintf(buf, "%s\n%s\n%s\n%s\n", + ((soc_mess_list[i].vict_found)?soc_mess_list[i].vict_found:"#"), + ((soc_mess_list[i].not_found)?soc_mess_list[i].not_found:"#"), + ((soc_mess_list[i].char_auto)?soc_mess_list[i].char_auto:"#"), + ((soc_mess_list[i].others_auto)?soc_mess_list[i].others_auto:"#")); + fprintf(fp, "%s", convert_from_tabs(buf)); + + sprintf(buf, "%s\n%s\n%s\n", + ((soc_mess_list[i].char_body_found)?soc_mess_list[i].char_body_found:"#"), + ((soc_mess_list[i].others_body_found)?soc_mess_list[i].others_body_found:"#"), + ((soc_mess_list[i].vict_body_found)?soc_mess_list[i].vict_body_found:"#")); + fprintf(fp, "%s", convert_from_tabs(buf)); + + sprintf(buf, "%s\n%s\n\n", + ((soc_mess_list[i].char_obj_found)?soc_mess_list[i].char_obj_found:"#"), + ((soc_mess_list[i].others_obj_found)?soc_mess_list[i].others_obj_found:"#")); + fprintf(fp, "%s", convert_from_tabs(buf)); + } + + fprintf(fp, "$\n"); + fclose(fp); + remove_from_save_list(AEDIT_PERMISSION, SL_ACT); } /* The Main Menu. */ -static void aedit_disp_menu(struct descriptor_data * d) { - struct social_messg *action = OLC_ACTION(d); - struct char_data *ch = d->character; +static void aedit_disp_menu(struct descriptor_data * d) +{ + struct social_messg *action = OLC_ACTION(d); + struct char_data *ch = d->character; - get_char_colors(ch); + get_char_colors(ch); - write_to_output(d, - "%s-- Action editor\r\n" - "%sn%s) Command : %s%-15.15s%s %s1%s) Sort as Command : %s%-15.15s%s\r\n" - "%s2%s) Min Position[CH]: %s%-8.8s %s3%s) Min Position [VT]: %s%-8.8s\r\n" - "%s4%s) Min Level [CH]: %s%-3d %s5%s) Show if Invisible: %s%s\r\n" - "%sa%s) Char [NO ARG]: %s%s\r\n" - "%sb%s) Others [NO ARG]: %s%s\r\n" - "%sc%s) Char [NOT FOUND]: %s%s\r\n" - "%sd%s) Char [ARG SELF]: %s%s\r\n" - "%se%s) Others[ARG SELF]: %s%s\r\n" - "%sf%s) Char [VICT]: %s%s\r\n" - "%sg%s) Others [VICT]: %s%s\r\n" - "%sh%s) Victim [VICT]: %s%s\r\n" - "%si%s) Char [BODY PRT]: %s%s\r\n" - "%sj%s) Others[BODY PRT]: %s%s\r\n" - "%sk%s) Victim[BODY PRT]: %s%s\r\n" - "%sl%s) Char [OBJ]: %s%s\r\n" - "%sm%s) Others [OBJ]: %s%s\r\n" - "%sq%s) Quit\r\n" - "Enter Choice:", - nrm, grn, nrm, - yel, action->command, nrm, - grn, nrm, - yel, action->sort_as, nrm, - grn, nrm, - cyn, position_types[action->min_char_position], - grn, nrm, - cyn, position_types[action->min_victim_position], - grn, nrm, - cyn, action->min_level_char, - grn, nrm, - cyn, (action->hide?"HIDDEN":"NOT HIDDEN"), - grn, nrm, cyn, - action->char_no_arg ? action->char_no_arg : "", - grn, nrm, cyn, - action->others_no_arg ? action->others_no_arg : "", - grn, nrm, cyn, - action->not_found ? action->not_found : "", - grn, nrm, cyn, - action->char_auto ? action->char_auto : "", - grn, nrm, cyn, - action->others_auto ? action->others_auto : "", - grn, nrm, cyn, - action->char_found ? action->char_found : "", - grn, nrm, cyn, - action->others_found ? action->others_found : "", - grn, nrm, cyn, - action->vict_found ? action->vict_found : "", - grn, nrm, cyn, - action->char_body_found ? action->char_body_found : "", - grn, nrm, cyn, - action->others_body_found ? action->others_body_found : "", - grn, nrm, cyn, - action->vict_body_found ? action->vict_body_found : "", - grn, nrm, cyn, - action->char_obj_found ? action->char_obj_found : "", - grn, nrm, cyn, - action->others_obj_found ? action->others_obj_found : "", - grn, nrm); + write_to_output(d, + "%s-- Action editor\r\n" + "%sn%s) Command : %s%-15.15s%s %s1%s) Sort as Command : %s%-15.15s%s\r\n" + "%s2%s) Min Position[CH]: %s%-8.8s %s3%s) Min Position [VT]: %s%-8.8s\r\n" + "%s4%s) Min Level [CH]: %s%-3d %s5%s) Show if Invisible: %s%s\r\n" + "%sa%s) Char [NO ARG]: %s%s\r\n" + "%sb%s) Others [NO ARG]: %s%s\r\n" + "%sc%s) Char [NOT FOUND]: %s%s\r\n" + "%sd%s) Char [ARG SELF]: %s%s\r\n" + "%se%s) Others[ARG SELF]: %s%s\r\n" + "%sf%s) Char [VICT]: %s%s\r\n" + "%sg%s) Others [VICT]: %s%s\r\n" + "%sh%s) Victim [VICT]: %s%s\r\n" + "%si%s) Char [BODY PRT]: %s%s\r\n" + "%sj%s) Others[BODY PRT]: %s%s\r\n" + "%sk%s) Victim[BODY PRT]: %s%s\r\n" + "%sl%s) Char [OBJ]: %s%s\r\n" + "%sm%s) Others [OBJ]: %s%s\r\n" + "%sq%s) Quit\r\n" + "Enter Choice:", + nrm, grn, nrm, + yel, action->command, nrm, + grn, nrm, + yel, action->sort_as, nrm, + grn, nrm, + cyn, position_types[action->min_char_position], + grn, nrm, + cyn, position_types[action->min_victim_position], + grn, nrm, + cyn, action->min_level_char, + grn, nrm, + cyn, (action->hide?"HIDDEN":"NOT HIDDEN"), + grn, nrm, cyn, + action->char_no_arg ? action->char_no_arg : "", + grn, nrm, cyn, + action->others_no_arg ? action->others_no_arg : "", + grn, nrm, cyn, + action->not_found ? action->not_found : "", + grn, nrm, cyn, + action->char_auto ? action->char_auto : "", + grn, nrm, cyn, + action->others_auto ? action->others_auto : "", + grn, nrm, cyn, + action->char_found ? action->char_found : "", + grn, nrm, cyn, + action->others_found ? action->others_found : "", + grn, nrm, cyn, + action->vict_found ? action->vict_found : "", + grn, nrm, cyn, + action->char_body_found ? action->char_body_found : "", + grn, nrm, cyn, + action->others_body_found ? action->others_body_found : "", + grn, nrm, cyn, + action->vict_body_found ? action->vict_body_found : "", + grn, nrm, cyn, + action->char_obj_found ? action->char_obj_found : "", + grn, nrm, cyn, + action->others_obj_found ? action->others_obj_found : "", + grn, nrm); - OLC_MODE(d) = AEDIT_MAIN_MENU; + OLC_MODE(d) = AEDIT_MAIN_MENU; } /* The main loop. */ -void aedit_parse(struct descriptor_data * d, char *arg) { - int i; +void aedit_parse(struct descriptor_data * d, char *arg) +{ + int i; - switch (OLC_MODE(d)) { + switch (OLC_MODE(d)) { case AEDIT_CONFIRM_SAVESTRING: - switch (*arg) { - case 'y': case 'Y': - aedit_save_internally(d); - mudlog (CMP, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits action %s", - GET_NAME(d->character), OLC_ACTION(d)->command); + switch (*arg) { + case 'y': + case 'Y': + aedit_save_internally(d); + mudlog (CMP, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits action %s", + GET_NAME(d->character), OLC_ACTION(d)->command); - /* do not free the strings.. just the structure */ - cleanup_olc(d, CLEANUP_STRUCTS); - write_to_output(d, "Action saved to disk.\r\n"); - break; - case 'n': case 'N': - /* free everything up, including strings etc */ - cleanup_olc(d, CLEANUP_ALL); - break; - default: - write_to_output(d, "Invalid choice!\r\n" + /* do not free the strings.. just the structure */ + cleanup_olc(d, CLEANUP_STRUCTS); + write_to_output(d, "Action saved to disk.\r\n"); + break; + case 'n': + case 'N': + /* free everything up, including strings etc */ + cleanup_olc(d, CLEANUP_ALL); + break; + default: + write_to_output(d, "Invalid choice!\r\n" "Do you wish to save your changes? : "); - break; - } - return; /* end of AEDIT_CONFIRM_SAVESTRING */ + break; + } + return; /* end of AEDIT_CONFIRM_SAVESTRING */ case AEDIT_CONFIRM_EDIT: - switch (*arg) { - case 'y': case 'Y': - aedit_setup_existing(d, OLC_ZNUM(d)); - break; - case 'q': case 'Q': - cleanup_olc(d, CLEANUP_ALL); - break; - case 'n': case 'N': - OLC_ZNUM(d)++; - for (;(OLC_ZNUM(d) <= top_of_socialt); OLC_ZNUM(d)++) - if (is_abbrev(OLC_STORAGE(d), soc_mess_list[OLC_ZNUM(d)].command)) - break; + switch (*arg) { + case 'y': + case 'Y': + aedit_setup_existing(d, OLC_ZNUM(d)); + break; + case 'q': + case 'Q': + cleanup_olc(d, CLEANUP_ALL); + break; + case 'n': + case 'N': + OLC_ZNUM(d)++; + for (; (OLC_ZNUM(d) <= top_of_socialt); OLC_ZNUM(d)++) + if (is_abbrev(OLC_STORAGE(d), soc_mess_list[OLC_ZNUM(d)].command)) + break; - if (OLC_ZNUM(d) > top_of_socialt) { - if (aedit_find_command(OLC_STORAGE(d)) != -1) { - cleanup_olc(d, CLEANUP_ALL); - break; + if (OLC_ZNUM(d) > top_of_socialt) { + if (aedit_find_command(OLC_STORAGE(d)) != -1) { + cleanup_olc(d, CLEANUP_ALL); + break; + } + write_to_output(d, "Do you wish to add the '%s' action? ", + OLC_STORAGE(d)); + OLC_MODE(d) = AEDIT_CONFIRM_ADD; + } else { + write_to_output(d, "Do you wish to edit the '%s' action? ", + soc_mess_list[OLC_ZNUM(d)].command); + OLC_MODE(d) = AEDIT_CONFIRM_EDIT; } - write_to_output(d, "Do you wish to add the '%s' action? ", - OLC_STORAGE(d)); - OLC_MODE(d) = AEDIT_CONFIRM_ADD; - } else { - write_to_output(d, "Do you wish to edit the '%s' action? ", - soc_mess_list[OLC_ZNUM(d)].command); - OLC_MODE(d) = AEDIT_CONFIRM_EDIT; - } - break; - default: - write_to_output(d, "Invalid choice!\r\n" + break; + default: + write_to_output(d, "Invalid choice!\r\n" "Do you wish to edit the '%s' action? ", soc_mess_list[OLC_ZNUM(d)].command); - break; - } - return; + break; + } + return; case AEDIT_CONFIRM_ADD: - switch (*arg) { - case 'y': case 'Y': - aedit_setup_new(d); - break; - case 'n': case 'N': case 'q': case 'Q': - cleanup_olc(d, CLEANUP_ALL); - break; - default: - write_to_output(d, "Invalid choice!\r\n" + switch (*arg) { + case 'y': + case 'Y': + aedit_setup_new(d); + break; + case 'n': + case 'N': + case 'q': + case 'Q': + cleanup_olc(d, CLEANUP_ALL); + break; + default: + write_to_output(d, "Invalid choice!\r\n" "Do you wish to add the '%s' action? ", OLC_STORAGE(d)); - break; - } - return; + break; + } + return; case AEDIT_MAIN_MENU: - switch (*arg) { - case 'q': case 'Q': - if (OLC_VAL(d)) { /* Something was modified */ - write_to_output(d, "Do you wish to save your changes? : "); - OLC_MODE(d) = AEDIT_CONFIRM_SAVESTRING; - } - else cleanup_olc(d, CLEANUP_ALL); - break; - case 'n': - write_to_output(d, "Enter action name: "); - OLC_MODE(d) = AEDIT_ACTION_NAME; - return; - case '1': - write_to_output(d, "Enter sort info for this action (for the command listing): "); - OLC_MODE(d) = AEDIT_SORT_AS; - return; - case '2': - write_to_output(d, "Enter the minimum position the Character has to be in to activate social:\r\n"); - for (i=POS_DEAD;i<=POS_STANDING;i++) - write_to_output(d, " %d) %s\r\n", i, position_types[i]); + switch (*arg) { + case 'q': + case 'Q': + if (OLC_VAL(d)) { /* Something was modified */ + write_to_output(d, "Do you wish to save your changes? : "); + OLC_MODE(d) = AEDIT_CONFIRM_SAVESTRING; + } else cleanup_olc(d, CLEANUP_ALL); + break; + case 'n': + write_to_output(d, "Enter action name: "); + OLC_MODE(d) = AEDIT_ACTION_NAME; + return; + case '1': + write_to_output(d, "Enter sort info for this action (for the command listing): "); + OLC_MODE(d) = AEDIT_SORT_AS; + return; + case '2': + write_to_output(d, "Enter the minimum position the Character has to be in to activate social:\r\n"); + for (i=POS_DEAD; i<=POS_STANDING; i++) + write_to_output(d, " %d) %s\r\n", i, position_types[i]); - write_to_output(d, "Enter choice: "); - OLC_MODE(d) = AEDIT_MIN_CHAR_POS; - return; - case '3': - write_to_output(d, "Enter the minimum position the Victim has to be in to activate social:\r\n"); - for (i=POS_DEAD;i<=POS_STANDING;i++) - write_to_output(d, " %d) %s\r\n", i, position_types[i]); + write_to_output(d, "Enter choice: "); + OLC_MODE(d) = AEDIT_MIN_CHAR_POS; + return; + case '3': + write_to_output(d, "Enter the minimum position the Victim has to be in to activate social:\r\n"); + for (i=POS_DEAD; i<=POS_STANDING; i++) + write_to_output(d, " %d) %s\r\n", i, position_types[i]); - write_to_output(d, "Enter choice: "); - OLC_MODE(d) = AEDIT_MIN_VICT_POS; - return; - case '4': - write_to_output(d, "Enter new minimum level for social: "); - OLC_MODE(d) = AEDIT_MIN_CHAR_LEVEL; - return; - case '5': - OLC_ACTION(d)->hide = !OLC_ACTION(d)->hide; - aedit_disp_menu(d); - OLC_VAL(d) = 1; - break; - case 'a': case 'A': - write_to_output(d, "Enter social shown to the Character when there is no argument supplied.\r\n" + write_to_output(d, "Enter choice: "); + OLC_MODE(d) = AEDIT_MIN_VICT_POS; + return; + case '4': + write_to_output(d, "Enter new minimum level for social: "); + OLC_MODE(d) = AEDIT_MIN_CHAR_LEVEL; + return; + case '5': + OLC_ACTION(d)->hide = !OLC_ACTION(d)->hide; + aedit_disp_menu(d); + OLC_VAL(d) = 1; + break; + case 'a': + case 'A': + write_to_output(d, "Enter social shown to the Character when there is no argument supplied.\r\n" "[OLD]: %s\r\n" "[NEW]: ", - ((OLC_ACTION(d)->char_no_arg)?OLC_ACTION(d)->char_no_arg:"NULL")); - OLC_MODE(d) = AEDIT_NOVICT_CHAR; - return; - case 'b': case 'B': - write_to_output(d, "Enter social shown to Others when there is no argument supplied.\r\n" + ((OLC_ACTION(d)->char_no_arg)?OLC_ACTION(d)->char_no_arg:"NULL")); + OLC_MODE(d) = AEDIT_NOVICT_CHAR; + return; + case 'b': + case 'B': + write_to_output(d, "Enter social shown to Others when there is no argument supplied.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->others_no_arg)?OLC_ACTION(d)->others_no_arg:"NULL")); - OLC_MODE(d) = AEDIT_NOVICT_OTHERS; - return; - case 'c': case 'C': - write_to_output(d, "Enter text shown to the Character when his victim isnt found.\r\n" + OLC_MODE(d) = AEDIT_NOVICT_OTHERS; + return; + case 'c': + case 'C': + write_to_output(d, "Enter text shown to the Character when his victim isnt found.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->not_found)?OLC_ACTION(d)->not_found:"NULL")); - OLC_MODE(d) = AEDIT_VICT_NOT_FOUND; - return; - case 'd': case 'D': - write_to_output(d, "Enter social shown to the Character when it is its own victim.\r\n" + OLC_MODE(d) = AEDIT_VICT_NOT_FOUND; + return; + case 'd': + case 'D': + write_to_output(d, "Enter social shown to the Character when it is its own victim.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->char_auto)?OLC_ACTION(d)->char_auto:"NULL")); - OLC_MODE(d) = AEDIT_SELF_CHAR; - return; - case 'e': case 'E': - write_to_output(d, "Enter social shown to Others when the Char is its own victim.\r\n" + OLC_MODE(d) = AEDIT_SELF_CHAR; + return; + case 'e': + case 'E': + write_to_output(d, "Enter social shown to Others when the Char is its own victim.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->others_auto)?OLC_ACTION(d)->others_auto:"NULL")); - OLC_MODE(d) = AEDIT_SELF_OTHERS; - return; - case 'f': case 'F': - write_to_output(d, "Enter normal social shown to the Character when the victim is found.\r\n" + OLC_MODE(d) = AEDIT_SELF_OTHERS; + return; + case 'f': + case 'F': + write_to_output(d, "Enter normal social shown to the Character when the victim is found.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->char_found)?OLC_ACTION(d)->char_found:"NULL")); - OLC_MODE(d) = AEDIT_VICT_CHAR_FOUND; - return; - case 'g': case 'G': - write_to_output(d, "Enter normal social shown to Others when the victim is found.\r\n" + OLC_MODE(d) = AEDIT_VICT_CHAR_FOUND; + return; + case 'g': + case 'G': + write_to_output(d, "Enter normal social shown to Others when the victim is found.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->others_found)?OLC_ACTION(d)->others_found:"NULL")); - OLC_MODE(d) = AEDIT_VICT_OTHERS_FOUND; - return; - case 'h': case 'H': - write_to_output(d, "Enter normal social shown to the Victim when the victim is found.\r\n" + OLC_MODE(d) = AEDIT_VICT_OTHERS_FOUND; + return; + case 'h': + case 'H': + write_to_output(d, "Enter normal social shown to the Victim when the victim is found.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->vict_found)?OLC_ACTION(d)->vict_found:"NULL")); - OLC_MODE(d) = AEDIT_VICT_VICT_FOUND; - return; - case 'i': case 'I': - write_to_output(d, "Enter 'body part' social shown to the Character when the victim is found.\r\n" + OLC_MODE(d) = AEDIT_VICT_VICT_FOUND; + return; + case 'i': + case 'I': + write_to_output(d, "Enter 'body part' social shown to the Character when the victim is found.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->char_body_found)?OLC_ACTION(d)->char_body_found:"NULL")); - OLC_MODE(d) = AEDIT_VICT_CHAR_BODY_FOUND; - return; - case 'j': case 'J': - write_to_output(d, "Enter 'body part' social shown to Others when the victim is found.\r\n" + OLC_MODE(d) = AEDIT_VICT_CHAR_BODY_FOUND; + return; + case 'j': + case 'J': + write_to_output(d, "Enter 'body part' social shown to Others when the victim is found.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->others_body_found)?OLC_ACTION(d)->others_body_found:"NULL")); - OLC_MODE(d) = AEDIT_VICT_OTHERS_BODY_FOUND; - return; - case 'k': case 'K': - write_to_output(d, "Enter 'body part' social shown to the Victim when the victim is found.\r\n" + OLC_MODE(d) = AEDIT_VICT_OTHERS_BODY_FOUND; + return; + case 'k': + case 'K': + write_to_output(d, "Enter 'body part' social shown to the Victim when the victim is found.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->vict_body_found)?OLC_ACTION(d)->vict_body_found:"NULL")); - OLC_MODE(d) = AEDIT_VICT_VICT_BODY_FOUND; - return; - case 'l': case 'L': - write_to_output(d, "Enter 'object' social shown to the Character when the object is found.\r\n" + OLC_MODE(d) = AEDIT_VICT_VICT_BODY_FOUND; + return; + case 'l': + case 'L': + write_to_output(d, "Enter 'object' social shown to the Character when the object is found.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->char_obj_found)?OLC_ACTION(d)->char_obj_found:"NULL")); - OLC_MODE(d) = AEDIT_OBJ_CHAR_FOUND; - return; - case 'm': case 'M': - write_to_output(d, "Enter 'object' social shown to the Room when the object is found.\r\n" + OLC_MODE(d) = AEDIT_OBJ_CHAR_FOUND; + return; + case 'm': + case 'M': + write_to_output(d, "Enter 'object' social shown to the Room when the object is found.\r\n" "[OLD]: %s\r\n" "[NEW]: ", ((OLC_ACTION(d)->others_obj_found)?OLC_ACTION(d)->others_obj_found:"NULL")); - OLC_MODE(d) = AEDIT_OBJ_OTHERS_FOUND; - return; - default: - aedit_disp_menu(d); - break; - } - return; + OLC_MODE(d) = AEDIT_OBJ_OTHERS_FOUND; + return; + default: + aedit_disp_menu(d); + break; + } + return; case AEDIT_ACTION_NAME: - if (!*arg || strchr(arg,' ')) { - aedit_disp_menu(d); - return; - } - if (OLC_ACTION(d)->command) - free(OLC_ACTION(d)->command); + if (!*arg || strchr(arg,' ')) { + aedit_disp_menu(d); + return; + } + if (OLC_ACTION(d)->command) + free(OLC_ACTION(d)->command); OLC_ACTION(d)->command = strdup(arg); - break; + break; case AEDIT_SORT_AS: - if (!*arg || strchr(arg,' ')) { - aedit_disp_menu(d); - return; - } - if (OLC_ACTION(d)->sort_as) { - free(OLC_ACTION(d)->sort_as); - OLC_ACTION(d)->sort_as = strdup(arg); - } - break; + if (!*arg || strchr(arg,' ')) { + aedit_disp_menu(d); + return; + } + if (OLC_ACTION(d)->sort_as) { + free(OLC_ACTION(d)->sort_as); + OLC_ACTION(d)->sort_as = strdup(arg); + } + break; case AEDIT_MIN_CHAR_POS: case AEDIT_MIN_VICT_POS: - if (!*arg) { - aedit_disp_menu(d); - return; - } - i = atoi(arg); - if ((i < POS_DEAD) && (i > POS_STANDING)) { - aedit_disp_menu(d); - return; - } - if (OLC_MODE(d) == AEDIT_MIN_CHAR_POS) - OLC_ACTION(d)->min_char_position = i; - else - OLC_ACTION(d)->min_victim_position = i; - break; + if (!*arg) { + aedit_disp_menu(d); + return; + } + i = atoi(arg); + if ((i < POS_DEAD) && (i > POS_STANDING)) { + aedit_disp_menu(d); + return; + } + if (OLC_MODE(d) == AEDIT_MIN_CHAR_POS) + OLC_ACTION(d)->min_char_position = i; + else + OLC_ACTION(d)->min_victim_position = i; + break; case AEDIT_MIN_CHAR_LEVEL: - if (!*arg) { - aedit_disp_menu(d); - return; - } - i = atoi(arg); - if ((i < 0) && (i > LVL_IMPL)) { - aedit_disp_menu(d); - return; - } - OLC_ACTION(d)->min_level_char = i; - break; + if (!*arg) { + aedit_disp_menu(d); + return; + } + i = atoi(arg); + if ((i < 0) && (i > LVL_IMPL)) { + aedit_disp_menu(d); + return; + } + OLC_ACTION(d)->min_level_char = i; + break; case AEDIT_NOVICT_CHAR: - if (OLC_ACTION(d)->char_no_arg) - free(OLC_ACTION(d)->char_no_arg); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->char_no_arg = strdup(arg); - } else - OLC_ACTION(d)->char_no_arg = NULL; - break; + if (OLC_ACTION(d)->char_no_arg) + free(OLC_ACTION(d)->char_no_arg); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->char_no_arg = strdup(arg); + } else + OLC_ACTION(d)->char_no_arg = NULL; + break; case AEDIT_NOVICT_OTHERS: - if (OLC_ACTION(d)->others_no_arg) - free(OLC_ACTION(d)->others_no_arg); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->others_no_arg = strdup(arg); - } else - OLC_ACTION(d)->others_no_arg = NULL; - break; + if (OLC_ACTION(d)->others_no_arg) + free(OLC_ACTION(d)->others_no_arg); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->others_no_arg = strdup(arg); + } else + OLC_ACTION(d)->others_no_arg = NULL; + break; case AEDIT_VICT_CHAR_FOUND: - if (OLC_ACTION(d)->char_found) - free(OLC_ACTION(d)->char_found); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->char_found = strdup(arg); - } else - OLC_ACTION(d)->char_found = NULL; - break; + if (OLC_ACTION(d)->char_found) + free(OLC_ACTION(d)->char_found); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->char_found = strdup(arg); + } else + OLC_ACTION(d)->char_found = NULL; + break; case AEDIT_VICT_OTHERS_FOUND: - if (OLC_ACTION(d)->others_found) - free(OLC_ACTION(d)->others_found); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->others_found = strdup(arg); - } else - OLC_ACTION(d)->others_found = NULL; - break; + if (OLC_ACTION(d)->others_found) + free(OLC_ACTION(d)->others_found); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->others_found = strdup(arg); + } else + OLC_ACTION(d)->others_found = NULL; + break; case AEDIT_VICT_VICT_FOUND: - if (OLC_ACTION(d)->vict_found) - free(OLC_ACTION(d)->vict_found); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->vict_found = strdup(arg); - } else - OLC_ACTION(d)->vict_found = NULL; - break; + if (OLC_ACTION(d)->vict_found) + free(OLC_ACTION(d)->vict_found); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->vict_found = strdup(arg); + } else + OLC_ACTION(d)->vict_found = NULL; + break; case AEDIT_VICT_NOT_FOUND: - if (OLC_ACTION(d)->not_found) - free(OLC_ACTION(d)->not_found); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->not_found = strdup(arg); - } else - OLC_ACTION(d)->not_found = NULL; - break; + if (OLC_ACTION(d)->not_found) + free(OLC_ACTION(d)->not_found); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->not_found = strdup(arg); + } else + OLC_ACTION(d)->not_found = NULL; + break; case AEDIT_SELF_CHAR: - if (OLC_ACTION(d)->char_auto) - free(OLC_ACTION(d)->char_auto); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->char_auto = strdup(arg); - } else - OLC_ACTION(d)->char_auto = NULL; - break; + if (OLC_ACTION(d)->char_auto) + free(OLC_ACTION(d)->char_auto); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->char_auto = strdup(arg); + } else + OLC_ACTION(d)->char_auto = NULL; + break; case AEDIT_SELF_OTHERS: - if (OLC_ACTION(d)->others_auto) - free(OLC_ACTION(d)->others_auto); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->others_auto = strdup(arg); - } else - OLC_ACTION(d)->others_auto = NULL; - break; + if (OLC_ACTION(d)->others_auto) + free(OLC_ACTION(d)->others_auto); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->others_auto = strdup(arg); + } else + OLC_ACTION(d)->others_auto = NULL; + break; case AEDIT_VICT_CHAR_BODY_FOUND: - if (OLC_ACTION(d)->char_body_found) - free(OLC_ACTION(d)->char_body_found); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->char_body_found = strdup(arg); - } else - OLC_ACTION(d)->char_body_found = NULL; - break; + if (OLC_ACTION(d)->char_body_found) + free(OLC_ACTION(d)->char_body_found); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->char_body_found = strdup(arg); + } else + OLC_ACTION(d)->char_body_found = NULL; + break; case AEDIT_VICT_OTHERS_BODY_FOUND: - if (OLC_ACTION(d)->others_body_found) - free(OLC_ACTION(d)->others_body_found); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->others_body_found = strdup(arg); - } else - OLC_ACTION(d)->others_body_found = NULL; - break; + if (OLC_ACTION(d)->others_body_found) + free(OLC_ACTION(d)->others_body_found); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->others_body_found = strdup(arg); + } else + OLC_ACTION(d)->others_body_found = NULL; + break; case AEDIT_VICT_VICT_BODY_FOUND: - if (OLC_ACTION(d)->vict_body_found) - free(OLC_ACTION(d)->vict_body_found); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->vict_body_found = strdup(arg); - } else - OLC_ACTION(d)->vict_body_found = NULL; - break; + if (OLC_ACTION(d)->vict_body_found) + free(OLC_ACTION(d)->vict_body_found); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->vict_body_found = strdup(arg); + } else + OLC_ACTION(d)->vict_body_found = NULL; + break; case AEDIT_OBJ_CHAR_FOUND: - if (OLC_ACTION(d)->char_obj_found) - free(OLC_ACTION(d)->char_obj_found); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->char_obj_found = strdup(arg); - } else - OLC_ACTION(d)->char_obj_found = NULL; - break; + if (OLC_ACTION(d)->char_obj_found) + free(OLC_ACTION(d)->char_obj_found); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->char_obj_found = strdup(arg); + } else + OLC_ACTION(d)->char_obj_found = NULL; + break; case AEDIT_OBJ_OTHERS_FOUND: - if (OLC_ACTION(d)->others_obj_found) - free(OLC_ACTION(d)->others_obj_found); - if (*arg) { - delete_doubledollar(arg); - OLC_ACTION(d)->others_obj_found = strdup(arg); - } else - OLC_ACTION(d)->others_obj_found = NULL; - break; + if (OLC_ACTION(d)->others_obj_found) + free(OLC_ACTION(d)->others_obj_found); + if (*arg) { + delete_doubledollar(arg); + OLC_ACTION(d)->others_obj_found = strdup(arg); + } else + OLC_ACTION(d)->others_obj_found = NULL; + break; default: - /* we should never get here */ - break; - } - OLC_VAL(d) = 1; - aedit_disp_menu(d); + /* we should never get here */ + break; + } + OLC_VAL(d) = 1; + aedit_disp_menu(d); } ACMD(do_astat) { - int i, real = FALSE; - char arg[MAX_INPUT_LENGTH]; + int i, real = FALSE; + char arg[MAX_INPUT_LENGTH]; - if (IS_NPC(ch)) - return; + if (IS_NPC(ch)) + return; - one_argument(argument, arg); + one_argument(argument, arg); - if(!*arg) { - send_to_char(ch, "Astat which social?\r\n"); - return; - } - - for (i = 0; i <= top_of_socialt; i++) { - if (is_abbrev(arg, soc_mess_list[i].command)) { - real = TRUE; - break; + if(!*arg) { + send_to_char(ch, "Astat which social?\r\n"); + return; } - } - if (!real) { - send_to_char(ch, "No such social.\r\n"); - return; - } + for (i = 0; i <= top_of_socialt; i++) { + if (is_abbrev(arg, soc_mess_list[i].command)) { + real = TRUE; + break; + } + } - get_char_colors(ch); - send_to_char(ch, - "n) Command : %s%-15.15s%s 1) Sort as Command : %s%-15.15s%s\r\n" - "2) Min Position[CH]: %s%-8.8s%s 3) Min Position[VT]: %s%-8.8s%s\r\n" - "4) Min Level [CH]: %s%-3d%s 5) Show if Invis : %s%s%s\r\n" - "a) Char [NO ARG]: %s%s%s\r\n" - "b) Others [NO ARG]: %s%s%s\r\n" - "c) Char [NOT FOUND]: %s%s%s\r\n" - "d) Char [ARG SELF]: %s%s%s\r\n" - "e) Others[ARG SELF]: %s%s%s\r\n" - "f) Char [VICT]: %s%s%s\r\n" - "g) Others [VICT]: %s%s%s\r\n" - "h) Victim [VICT]: %s%s%s\r\n" - "i) Char [BODY PRT]: %s%s%s\r\n" - "j) Others[BODY PRT]: %s%s%s\r\n" - "k) Victim[BODY PRT]: %s%s%s\r\n" - "l) Char [OBJ]: %s%s%s\r\n" - "m) Others [OBJ]: %s%s%s\r\n", + if (!real) { + send_to_char(ch, "No such social.\r\n"); + return; + } - yel, soc_mess_list[i].command, nrm, - yel, soc_mess_list[i].sort_as, nrm, - cyn, position_types[soc_mess_list[i].min_char_position], nrm, - cyn, position_types[soc_mess_list[i].min_victim_position], nrm, - cyn, soc_mess_list[i].min_level_char, nrm, - cyn, (soc_mess_list[i].hide ? "HIDDEN" : "NOT HIDDEN"), nrm, - cyn, soc_mess_list[i].char_no_arg ? soc_mess_list[i].char_no_arg : "", nrm, - cyn, soc_mess_list[i].others_no_arg ? soc_mess_list[i].others_no_arg : "", nrm, - cyn, soc_mess_list[i].not_found ? soc_mess_list[i].not_found : "", nrm, - cyn, soc_mess_list[i].char_auto ? soc_mess_list[i].char_auto : "", nrm, - cyn, soc_mess_list[i].others_auto ? soc_mess_list[i].others_auto : "", nrm, - cyn, soc_mess_list[i].char_found ? soc_mess_list[i].char_found : "", nrm, - cyn, soc_mess_list[i].others_found ? soc_mess_list[i].others_found : "", nrm, - cyn, soc_mess_list[i].vict_found ? soc_mess_list[i].vict_found : "", nrm, - cyn, soc_mess_list[i].char_body_found ? soc_mess_list[i].char_body_found : "", nrm, - cyn, soc_mess_list[i].others_body_found ? soc_mess_list[i].others_body_found : "", nrm, - cyn, soc_mess_list[i].vict_body_found ? soc_mess_list[i].vict_body_found : "", nrm, - cyn, soc_mess_list[i].char_obj_found ? soc_mess_list[i].char_obj_found : "", nrm, - cyn, soc_mess_list[i].others_obj_found ? soc_mess_list[i].others_obj_found : "", nrm); + get_char_colors(ch); + send_to_char(ch, + "n) Command : %s%-15.15s%s 1) Sort as Command : %s%-15.15s%s\r\n" + "2) Min Position[CH]: %s%-8.8s%s 3) Min Position[VT]: %s%-8.8s%s\r\n" + "4) Min Level [CH]: %s%-3d%s 5) Show if Invis : %s%s%s\r\n" + "a) Char [NO ARG]: %s%s%s\r\n" + "b) Others [NO ARG]: %s%s%s\r\n" + "c) Char [NOT FOUND]: %s%s%s\r\n" + "d) Char [ARG SELF]: %s%s%s\r\n" + "e) Others[ARG SELF]: %s%s%s\r\n" + "f) Char [VICT]: %s%s%s\r\n" + "g) Others [VICT]: %s%s%s\r\n" + "h) Victim [VICT]: %s%s%s\r\n" + "i) Char [BODY PRT]: %s%s%s\r\n" + "j) Others[BODY PRT]: %s%s%s\r\n" + "k) Victim[BODY PRT]: %s%s%s\r\n" + "l) Char [OBJ]: %s%s%s\r\n" + "m) Others [OBJ]: %s%s%s\r\n", + + yel, soc_mess_list[i].command, nrm, + yel, soc_mess_list[i].sort_as, nrm, + cyn, position_types[soc_mess_list[i].min_char_position], nrm, + cyn, position_types[soc_mess_list[i].min_victim_position], nrm, + cyn, soc_mess_list[i].min_level_char, nrm, + cyn, (soc_mess_list[i].hide ? "HIDDEN" : "NOT HIDDEN"), nrm, + cyn, soc_mess_list[i].char_no_arg ? soc_mess_list[i].char_no_arg : "", nrm, + cyn, soc_mess_list[i].others_no_arg ? soc_mess_list[i].others_no_arg : "", nrm, + cyn, soc_mess_list[i].not_found ? soc_mess_list[i].not_found : "", nrm, + cyn, soc_mess_list[i].char_auto ? soc_mess_list[i].char_auto : "", nrm, + cyn, soc_mess_list[i].others_auto ? soc_mess_list[i].others_auto : "", nrm, + cyn, soc_mess_list[i].char_found ? soc_mess_list[i].char_found : "", nrm, + cyn, soc_mess_list[i].others_found ? soc_mess_list[i].others_found : "", nrm, + cyn, soc_mess_list[i].vict_found ? soc_mess_list[i].vict_found : "", nrm, + cyn, soc_mess_list[i].char_body_found ? soc_mess_list[i].char_body_found : "", nrm, + cyn, soc_mess_list[i].others_body_found ? soc_mess_list[i].others_body_found : "", nrm, + cyn, soc_mess_list[i].vict_body_found ? soc_mess_list[i].vict_body_found : "", nrm, + cyn, soc_mess_list[i].char_obj_found ? soc_mess_list[i].char_obj_found : "", nrm, + cyn, soc_mess_list[i].others_obj_found ? soc_mess_list[i].others_obj_found : "", nrm); } static int aedit_find_command(const char *txt) { - int cmd; + int cmd; - for (cmd = 1; *complete_cmd_info[cmd].command != '\n'; cmd++) - if (!strncmp(complete_cmd_info[cmd].sort_as, txt, strlen(txt)) || - !strcmp(complete_cmd_info[cmd].command, txt)) - return (cmd); - return (-1); + for (cmd = 1; *complete_cmd_info[cmd].command != '\n'; cmd++) + if (!strncmp(complete_cmd_info[cmd].sort_as, txt, strlen(txt)) || + !strcmp(complete_cmd_info[cmd].command, txt)) + return (cmd); + return (-1); } diff --git a/src/ban.h b/src/ban.h index e87747d..c123df8 100644 --- a/src/ban.h +++ b/src/ban.h @@ -1,18 +1,18 @@ /** * @file boards.h * Header file for the bulletin board system (boards.c). -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. -* +* * @todo Utility functions that could easily be moved elsewhere have been * marked. Suggest a review of all utility functions (aka. non ACMDs) and * determine if the utility functions should be placed into a lower level -* shared module. +* shared module. * */ #ifndef _BAN_H_ @@ -26,11 +26,11 @@ #define BANNED_SITE_LENGTH 50 struct ban_list_element { - char site[BANNED_SITE_LENGTH+1]; - int type; - time_t date; - char name[MAX_NAME_LENGTH+1]; - struct ban_list_element *next; + char site[BANNED_SITE_LENGTH+1]; + int type; + time_t date; + char name[MAX_NAME_LENGTH+1]; + struct ban_list_element *next; }; /* Global functions */ diff --git a/src/boards.h b/src/boards.h index 46c7b40..13819a2 100644 --- a/src/boards.h +++ b/src/boards.h @@ -1,41 +1,41 @@ /** * @file boards.h * Header file for the bulletin board system (boards.c). -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * */ #ifndef _BOARDS_H_ #define _BOARDS_H_ -#define NUM_OF_BOARDS 7 /* change if needed! */ -#define MAX_BOARD_MESSAGES 60 /* arbitrary -- change if needed */ -#define MAX_MESSAGE_LENGTH 4096 /* arbitrary -- change if needed */ +#define NUM_OF_BOARDS 7 /* change if needed! */ +#define MAX_BOARD_MESSAGES 60 /* arbitrary -- change if needed */ +#define MAX_MESSAGE_LENGTH 4096 /* arbitrary -- change if needed */ -#define INDEX_SIZE ((NUM_OF_BOARDS*MAX_BOARD_MESSAGES) + 5) +#define INDEX_SIZE ((NUM_OF_BOARDS*MAX_BOARD_MESSAGES) + 5) -#define BOARD_MAGIC 1048575 /* arbitrary number - see modify.c */ +#define BOARD_MAGIC 1048575 /* arbitrary number - see modify.c */ struct board_msginfo { - int slot_num; /* pos of message in "master index" */ - char *heading; /* pointer to message's heading */ - int level; /* level of poster */ - int heading_len; /* size of header (for file write) */ - int message_len; /* size of message text (for file write) */ + int slot_num; /* pos of message in "master index" */ + char *heading; /* pointer to message's heading */ + int level; /* level of poster */ + int heading_len; /* size of header (for file write) */ + int message_len; /* size of message text (for file write) */ }; struct board_info_type { - obj_vnum vnum; /* vnum of this board */ - int read_lvl; /* min level to read messages on this board */ - int write_lvl; /* min level to write messages on this board */ - int remove_lvl; /* min level to remove messages from this board */ - char filename[50]; /* file to save this board to */ - obj_rnum rnum; /* rnum of this board */ + obj_vnum vnum; /* vnum of this board */ + int read_lvl; /* min level to read messages on this board */ + int write_lvl; /* min level to write messages on this board */ + int remove_lvl; /* min level to remove messages from this board */ + char filename[50]; /* file to save this board to */ + obj_rnum rnum; /* rnum of this board */ }; #define BOARD_VNUM(i) (board_info[i].vnum) diff --git a/src/bsd-snprintf.h b/src/bsd-snprintf.h index d1a6399..65eba78 100644 --- a/src/bsd-snprintf.h +++ b/src/bsd-snprintf.h @@ -1,9 +1,9 @@ /** * @file bsd-snprintf.h * Used if your OS does not provide snprintf() or vsnprintf(). -* +* * Part of the core tbaMUD source code distribution, which is a derivative -* of, and continuation of, CircleMUD. +* of, and continuation of, CircleMUD. */ /* This file taken from openbsd-compat of OpenSSH 3.1: diff --git a/src/class.h b/src/class.h index a2a45aa..10be86b 100644 --- a/src/class.h +++ b/src/class.h @@ -1,13 +1,13 @@ /** * @file class.h * Header file for class specific functions and variables. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * */ #ifndef _CLASS_H_ diff --git a/src/comm.h b/src/comm.h index 9837c86..6e90739 100644 --- a/src/comm.h +++ b/src/comm.h @@ -13,24 +13,18 @@ #ifndef _COMM_H_ #define _COMM_H_ -#define NUM_RESERVED_DESCS 8 +#define NUM_RESERVED_DESCS 8 #define COPYOVER_FILE "copyover.dat" /* comm.c */ void close_socket(struct descriptor_data *d); void game_info(const char *messg, ...) __attribute__ ((format (printf, 1, 2))); -size_t send_to_char(struct char_data *ch, const char *messg, ...) __attribute__ - ((format (printf, 2, 3))); -void send_to_all(const char *messg, ...) __attribute__ ((format (printf, 1, - 2))); -void send_to_room(room_rnum room, const char *messg, ...) __attribute__ ((format - (printf, 2, 3))); -void send_to_outdoor(const char *messg, ...) __attribute__ ((format (printf, 1, - 2))); -void send_to_group(struct char_data *ch, struct group_data *group, const char * msg, ...) __attribute__ ((format - (printf, 3, 4))); -void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...) - __attribute__ ((format (printf, 3, 4))); +size_t send_to_char(struct char_data *ch, const char *messg, ...) __attribute__((format (printf, 2, 3))); +void send_to_all(const char *messg, ...) __attribute__ ((format (printf, 1, 2))); +void send_to_room(room_rnum room, const char *messg, ...) __attribute__ ((format (printf, 2, 3))); +void send_to_outdoor(const char *messg, ...) __attribute__ ((format (printf, 1, 2))); +void send_to_group(struct char_data *ch, struct group_data *group, const char * msg, ...) __attribute__ ((format(printf, 3, 4))); +void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...) __attribute__ ((format (printf, 3, 4))); /* Act type settings and flags */ #define TO_ROOM 1 /**< act() type: to everyone in room, except ch. */ @@ -38,7 +32,7 @@ void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...) #define TO_NOTVICT 3 /**< act() type: to everyone in room, not ch or vict_obj. */ #define TO_CHAR 4 /**< act() type: to ch. */ #define TO_GMOTE 5 /**< act() type: to gemote channel (global emote) */ -#define TO_SLEEP 128 /**< act() flag: to char, even if sleeping */ +#define TO_SLEEP 128 /**< act() flag: to char, even if sleeping */ #define DG_NO_TRIG 256 /**< act() flag: don't check act trigger */ @@ -47,10 +41,10 @@ void perform_act(const char *orig, struct char_data *ch, struct obj_data *obj, v char * act(const char *str, int hide_invisible, struct char_data *ch, struct obj_data *obj, void *vict_obj, int type); /* I/O functions */ -void write_to_q(const char *txt, struct txt_q *queue, int aliased); -int write_to_descriptor(socket_t desc, const char *txt); -size_t write_to_output(struct descriptor_data *d, const char *txt, ...) __attribute__ ((format (printf, 2, 3))); -size_t vwrite_to_output(struct descriptor_data *d, const char *format, va_list args); +void write_to_q(const char *txt, struct txt_q *queue, int aliased); +int write_to_descriptor(socket_t desc, const char *txt); +size_t write_to_output(struct descriptor_data *d, const char *txt, ...) __attribute__ ((format (printf, 2, 3))); +size_t vwrite_to_output(struct descriptor_data *d, const char *format, va_list args); typedef RETSIGTYPE sigfunc(int); diff --git a/src/db.h b/src/db.h index 9786d62..7d8f935 100644 --- a/src/db.h +++ b/src/db.h @@ -15,98 +15,98 @@ /* arbitrary constants used by index_boot() (must be unique) */ -#define DB_BOOT_WLD 0 -#define DB_BOOT_MOB 1 -#define DB_BOOT_OBJ 2 -#define DB_BOOT_ZON 3 -#define DB_BOOT_SHP 4 -#define DB_BOOT_HLP 5 -#define DB_BOOT_TRG 6 +#define DB_BOOT_WLD 0 +#define DB_BOOT_MOB 1 +#define DB_BOOT_OBJ 2 +#define DB_BOOT_ZON 3 +#define DB_BOOT_SHP 4 +#define DB_BOOT_HLP 5 +#define DB_BOOT_TRG 6 #define DB_BOOT_QST 7 #if defined(CIRCLE_MACINTOSH) -#define LIB_WORLD ":world:" -#define LIB_TEXT ":text:" -#define LIB_TEXT_HELP ":text:help:" -#define LIB_MISC ":misc:" -#define LIB_ETC ":etc:" -#define LIB_PLRTEXT ":plrtext:" -#define LIB_PLROBJS ":plrobjs:" -#define LIB_PLRVARS ":plrvars:" -#define LIB_PLRFILES ":plrfiles:" -#define LIB_HOUSE ":house:" -#define SLASH ":" +#define LIB_WORLD ":world:" +#define LIB_TEXT ":text:" +#define LIB_TEXT_HELP ":text:help:" +#define LIB_MISC ":misc:" +#define LIB_ETC ":etc:" +#define LIB_PLRTEXT ":plrtext:" +#define LIB_PLROBJS ":plrobjs:" +#define LIB_PLRVARS ":plrvars:" +#define LIB_PLRFILES ":plrfiles:" +#define LIB_HOUSE ":house:" +#define SLASH ":" #elif defined(CIRCLE_AMIGA) || defined(CIRCLE_UNIX) || defined(CIRCLE_WINDOWS) || defined(CIRCLE_ACORN) || defined(CIRCLE_VMS) -#define LIB_WORLD "world/" -#define LIB_TEXT "text/" -#define LIB_TEXT_HELP "text/help/" -#define LIB_MISC "misc/" -#define LIB_ETC "etc/" -#define LIB_PLRTEXT "plrtext/" -#define LIB_PLROBJS "plrobjs/" -#define LIB_PLRVARS "plrvars/" -#define LIB_HOUSE "house/" -#define LIB_PLRFILES "plrfiles/" -#define SLASH "/" +#define LIB_WORLD "world/" +#define LIB_TEXT "text/" +#define LIB_TEXT_HELP "text/help/" +#define LIB_MISC "misc/" +#define LIB_ETC "etc/" +#define LIB_PLRTEXT "plrtext/" +#define LIB_PLROBJS "plrobjs/" +#define LIB_PLRVARS "plrvars/" +#define LIB_HOUSE "house/" +#define LIB_PLRFILES "plrfiles/" +#define SLASH "/" #else #error "Unknown path components." #endif -#define SUF_OBJS "objs" -#define SUF_TEXT "text" -#define SUF_MEM "mem" -#define SUF_PLR "plr" +#define SUF_OBJS "objs" +#define SUF_TEXT "text" +#define SUF_MEM "mem" +#define SUF_PLR "plr" #if defined(CIRCLE_AMIGA) -#define EXE_FILE "/bin/circle" /* maybe use argv[0] but it's not reliable */ -#define KILLSCRIPT_FILE "/.killscript" /* autorun: shut mud down */ -#define PAUSE_FILE "/pause" /* autorun: don't restart mud */ +#define EXE_FILE "/bin/circle" /* maybe use argv[0] but it's not reliable */ +#define KILLSCRIPT_FILE "/.killscript" /* autorun: shut mud down */ +#define PAUSE_FILE "/pause" /* autorun: don't restart mud */ #elif defined(CIRCLE_MACINTOSH) -#define EXE_FILE "::bin:circle" /* maybe use argv[0] but it's not reliable */ -#define FASTBOOT_FILE "::.fastboot" /* autorun: boot without sleep */ -#define KILLSCRIPT_FILE "::.killscript" /* autorun: shut mud down */ -#define PAUSE_FILE "::pause" /* autorun: don't restart mud */ +#define EXE_FILE "::bin:circle" /* maybe use argv[0] but it's not reliable */ +#define FASTBOOT_FILE "::.fastboot" /* autorun: boot without sleep */ +#define KILLSCRIPT_FILE "::.killscript" /* autorun: shut mud down */ +#define PAUSE_FILE "::pause" /* autorun: don't restart mud */ #else -#define EXE_FILE "bin/circle" /* maybe use argv[0] but it's not reliable */ -#define FASTBOOT_FILE "../.fastboot" /* autorun: boot without sleep */ -#define KILLSCRIPT_FILE "../.killscript"/* autorun: shut mud down */ -#define PAUSE_FILE "../pause" /* autorun: don't restart mud */ +#define EXE_FILE "bin/circle" /* maybe use argv[0] but it's not reliable */ +#define FASTBOOT_FILE "../.fastboot" /* autorun: boot without sleep */ +#define KILLSCRIPT_FILE "../.killscript"/* autorun: shut mud down */ +#define PAUSE_FILE "../pause" /* autorun: don't restart mud */ #endif /* names of various files and directories */ -#define INDEX_FILE "index" /* index of world files */ -#define MINDEX_FILE "index.mini" /* ... and for mini-mud-mode */ -#define WLD_PREFIX LIB_WORLD"wld"SLASH /* room definitions */ -#define MOB_PREFIX LIB_WORLD"mob"SLASH /* monster prototypes */ -#define OBJ_PREFIX LIB_WORLD"obj"SLASH /* object prototypes */ -#define ZON_PREFIX LIB_WORLD"zon"SLASH /* zon defs & command tables */ -#define SHP_PREFIX LIB_WORLD"shp"SLASH /* shop definitions */ -#define TRG_PREFIX LIB_WORLD"trg"SLASH /* trigger files */ -#define HLP_PREFIX LIB_TEXT"help"SLASH /* Help files */ -#define QST_PREFIX LIB_WORLD"qst"SLASH /* quest files */ +#define INDEX_FILE "index" /* index of world files */ +#define MINDEX_FILE "index.mini" /* ... and for mini-mud-mode */ +#define WLD_PREFIX LIB_WORLD"wld"SLASH /* room definitions */ +#define MOB_PREFIX LIB_WORLD"mob"SLASH /* monster prototypes */ +#define OBJ_PREFIX LIB_WORLD"obj"SLASH /* object prototypes */ +#define ZON_PREFIX LIB_WORLD"zon"SLASH /* zon defs & command tables */ +#define SHP_PREFIX LIB_WORLD"shp"SLASH /* shop definitions */ +#define TRG_PREFIX LIB_WORLD"trg"SLASH /* trigger files */ +#define HLP_PREFIX LIB_TEXT"help"SLASH /* Help files */ +#define QST_PREFIX LIB_WORLD"qst"SLASH /* quest files */ -#define CREDITS_FILE LIB_TEXT"credits" /* for the 'credits' command */ -#define NEWS_FILE LIB_TEXT"news" /* for the 'news' command */ -#define MOTD_FILE LIB_TEXT"motd" /* messages of the day / mortal */ -#define IMOTD_FILE LIB_TEXT"imotd" /* messages of the day / immort */ -#define GREETINGS_FILE LIB_TEXT"greetings" /* The opening screen. */ -#define HELP_PAGE_FILE LIB_TEXT_HELP"help" /* for HELP */ -#define IHELP_PAGE_FILE LIB_TEXT_HELP"ihelp" /* for HELP imms */ -#define INFO_FILE LIB_TEXT"info" /* for INFO */ -#define WIZLIST_FILE LIB_TEXT"wizlist" /* for WIZLIST */ -#define IMMLIST_FILE LIB_TEXT"immlist" /* for IMMLIST */ -#define BACKGROUND_FILE LIB_TEXT"background"/* for the background story */ -#define POLICIES_FILE LIB_TEXT"policies" /* player policies/rules */ -#define HANDBOOK_FILE LIB_TEXT"handbook" /* handbook for new immorts */ +#define CREDITS_FILE LIB_TEXT"credits" /* for the 'credits' command */ +#define NEWS_FILE LIB_TEXT"news" /* for the 'news' command */ +#define MOTD_FILE LIB_TEXT"motd" /* messages of the day / mortal */ +#define IMOTD_FILE LIB_TEXT"imotd" /* messages of the day / immort */ +#define GREETINGS_FILE LIB_TEXT"greetings" /* The opening screen. */ +#define HELP_PAGE_FILE LIB_TEXT_HELP"help" /* for HELP */ +#define IHELP_PAGE_FILE LIB_TEXT_HELP"ihelp" /* for HELP imms */ +#define INFO_FILE LIB_TEXT"info" /* for INFO */ +#define WIZLIST_FILE LIB_TEXT"wizlist" /* for WIZLIST */ +#define IMMLIST_FILE LIB_TEXT"immlist" /* for IMMLIST */ +#define BACKGROUND_FILE LIB_TEXT"background" /* for the background story */ +#define POLICIES_FILE LIB_TEXT"policies" /* player policies/rules */ +#define HANDBOOK_FILE LIB_TEXT"handbook" /* handbook for new immorts */ #define HELP_FILE "help.hlp" -#define IDEAS_FILE LIB_MISC"ideas" /* for the 'idea'-command */ -#define TYPOS_FILE LIB_MISC"typos" /* 'typo' */ -#define BUGS_FILE LIB_MISC"bugs" /* 'bug' */ -#define MESS_FILE LIB_MISC"messages" /* damage messages */ -#define SOCMESS_FILE LIB_MISC"socials" /* messages for social acts */ -#define SOCMESS_FILE_NEW LIB_MISC"socials.new" /* messages for social acts with aedit patch*/ -#define XNAME_FILE LIB_MISC"xnames" /* invalid name substrings */ +#define IDEAS_FILE LIB_MISC"ideas" /* for the 'idea'-command */ +#define TYPOS_FILE LIB_MISC"typos" /* 'typo' */ +#define BUGS_FILE LIB_MISC"bugs" /* 'bug' */ +#define MESS_FILE LIB_MISC"messages" /* damage messages */ +#define SOCMESS_FILE LIB_MISC"socials" /* messages for social acts */ +#define SOCMESS_FILE_NEW LIB_MISC"socials.new" /* messages for social acts with aedit patch*/ +#define XNAME_FILE LIB_MISC"xnames" /* invalid name substrings */ /* BEGIN: Assumed default locations for logfiles, mainly used in do_file. */ /**/ @@ -129,109 +129,108 @@ /**/ /* END: Assumed default locations for logfiles, mainly used in do_file. */ -#define CONFIG_FILE LIB_ETC"config" /* OasisOLC * GAME CONFIG FL */ -#define PLAYER_FILE LIB_ETC"players" /* the player database */ -#define MAIL_FILE LIB_ETC"plrmail" /* for the mudmail system */ -#define MAIL_FILE_TMP LIB_ETC"plrmail_tmp" /* for the mudmail system */ -#define BAN_FILE LIB_ETC"badsites" /* for the siteban system */ -#define HCONTROL_FILE LIB_ETC"hcontrol" /* for the house system */ -#define TIME_FILE LIB_ETC"time" /* for calendar system */ -#define CHANGE_LOG_FILE "../changelog" /* for the changelog */ +#define CONFIG_FILE LIB_ETC"config" /* OasisOLC * GAME CONFIG FL */ +#define PLAYER_FILE LIB_ETC"players" /* the player database */ +#define MAIL_FILE LIB_ETC"plrmail" /* for the mudmail system */ +#define MAIL_FILE_TMP LIB_ETC"plrmail_tmp" /* for the mudmail system */ +#define BAN_FILE LIB_ETC"badsites" /* for the siteban system */ +#define HCONTROL_FILE LIB_ETC"hcontrol" /* for the house system */ +#define TIME_FILE LIB_ETC"time" /* for calendar system */ +#define CHANGE_LOG_FILE "../changelog" /* for the changelog */ /* new bitvector data for use in player_index_element */ -#define PINDEX_DELETED (1 << 0) /* deleted player */ -#define PINDEX_NODELETE (1 << 1) /* protected player */ -#define PINDEX_SELFDELETE (1 << 2) /* player is selfdeleting*/ -#define PINDEX_NOWIZLIST (1 << 3) /* Player shouldn't be on wizlist*/ +#define PINDEX_DELETED (1 << 0) /* deleted player */ +#define PINDEX_NODELETE (1 << 1) /* protected player */ +#define PINDEX_SELFDELETE (1 << 2) /* player is selfdeleting */ +#define PINDEX_NOWIZLIST (1 << 3) /* Player shouldn't be on wizlist */ #define REAL 0 #define VIRTUAL 1 /* structure for the reset commands */ struct reset_com { - char command; /* current command */ + char command; /* current command */ - bool if_flag; /* if TRUE: exe only if preceding exe'd */ - int arg1; /* */ - int arg2; /* Arguments to the command */ - int arg3; /* */ - int line; /* line number this command appears on */ - char *sarg1; /* string argument */ - char *sarg2; /* string argument */ + bool if_flag; /* if TRUE: exe only if preceding exe'd */ + int arg1; /* */ + int arg2; /* Arguments to the command */ + int arg3; /* */ + int line; /* line number this command appears on */ + char *sarg1; /* string argument */ + char *sarg2; /* string argument */ - /* Commands: - * 'M': Read a mobile - * 'O': Read an object - * 'G': Give obj to mob - * 'P': Put obj in obj - * 'G': Obj to char - * 'E': Obj to char equip - * 'D': Set state of door - * 'T': Trigger command - * 'V': Assign a variable */ + /* Commands: + * 'M': Read a mobile + * 'O': Read an object + * 'G': Give obj to mob + * 'P': Put obj in obj + * 'G': Obj to char + * 'E': Obj to char equip + * 'D': Set state of door + * 'T': Trigger command + * 'V': Assign a variable */ }; /* zone definition structure. for the 'zone-table' */ struct zone_data { - char *name; /* name of this zone */ - char *builders; /* namelist of builders allowed to */ - /* modify this zone. */ - int lifespan; /* how long between resets (minutes) */ - int age; /* current age of this zone (minutes) */ - room_vnum bot; /* starting room number for this zone */ - room_vnum top; /* upper limit for rooms in this zone */ + char *name; /* name of this zone */ + char *builders; /* namelist of builders allowed to modify this zone. */ + int lifespan; /* how long between resets (minutes) */ + int age; /* current age of this zone (minutes) */ + room_vnum bot; /* starting room number for this zone */ + room_vnum top; /* upper limit for rooms in this zone */ - int zone_flags[ZN_ARRAY_MAX]; /* Zone Flags bitvector */ - int min_level; /* Minimum level a player must be to enter this zone */ - int max_level; /* Maximum level a player must be to enter this zone */ + int zone_flags[ZN_ARRAY_MAX]; /* Zone Flags bitvector */ + int min_level; /* Minimum level a player must be to enter this zone */ + int max_level; /* Maximum level a player must be to enter this zone */ - int reset_mode; /* conditions for reset (see below) */ - zone_vnum number; /* virtual number of this zone */ - struct reset_com *cmd; /* command table for reset */ + int reset_mode; /* conditions for reset (see below) */ + zone_vnum number; /* virtual number of this zone */ + struct reset_com *cmd; /* command table for reset */ - /* Reset mode: - * 0: Don't reset, and don't update age. - * 1: Reset if no PC's are located in zone. - * 2: Just reset. */ + /* Reset mode: + * 0: Don't reset, and don't update age. + * 1: Reset if no PC's are located in zone. + * 2: Just reset. */ }; /* for queueing zones for update */ struct reset_q_element { - zone_rnum zone_to_reset; /* ref to zone_data */ - struct reset_q_element *next; + zone_rnum zone_to_reset; /* ref to zone_data */ + struct reset_q_element *next; }; /* structure for the update queue */ struct reset_q_type { - struct reset_q_element *head; - struct reset_q_element *tail; + struct reset_q_element *head; + struct reset_q_element *tail; }; /* Added level, flags, and last, primarily for pfile autocleaning. You can also * use them to keep online statistics, and add race, class, etc if you like. */ struct player_index_element { - char *name; - long id; - int level; - int flags; - time_t last; + char *name; + long id; + int level; + int flags; + time_t last; }; struct help_index_element { - char *index; /*Future Use */ - char *keywords; /*Keyword Place holder and sorter */ - char *entry; /*Entries for help files with Keywords at very top*/ - int duplicate; /*Duplicate entries for multple keywords*/ - int min_level; /*Min Level to read help entry*/ + char *index; /* Future Use */ + char *keywords; /* Keyword Place holder and sorter */ + char *entry; /* Entries for help files with Keywords at very top */ + int duplicate; /* Duplicate entries for multple keywords */ + int min_level; /* Min Level to read help entry */ }; /* The ban defines and structs were moved to ban.h */ /* for the "buffered" rent and house object loading */ struct obj_save_data_t { - struct obj_data *obj; - int locate; - struct obj_save_data_t *next; + struct obj_data *obj; + int locate; + struct obj_save_data_t *next; }; typedef struct obj_save_data_t obj_save_data; diff --git a/src/dg_event.h b/src/dg_event.h index ee36e47..4dfbe68 100644 --- a/src/dg_event.h +++ b/src/dg_event.h @@ -1,18 +1,18 @@ /** * @file dg_event.h -* This file contains defines for the simplified event system to allow trigedit +* This file contains defines for the simplified event system to allow trigedit * to use the "wait" command, causing a delay in the middle of a script. * This system could easily be expanded by coders who wish to implement * an event driven mud. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This source code, which was not part of the CircleMUD legacy code, -* is attributed to: -* $Author: Mark A. Heilpern/egreen/Welcor $ -* $Date: 2004/10/11 12:07:00$ -* $Revision: 1.0.14 $ +* is attributed to: +* $Author: Mark A. Heilpern/egreen/Welcor $ +* $Date: 2004/10/11 12:07:00$ +* $Revision: 1.0.14 $ */ #ifndef _DG_EVENT_H_ #define _DG_EVENT_H_ @@ -30,10 +30,10 @@ /** The event structure. Events get attached to the queue and are executed * when their turn comes up in the queue. */ struct event { - EVENTFUNC(*func); /**< The function called when this event comes up. */ - void *event_obj; /**< event_obj is passed to func when func is called */ - struct q_element *q_el; /**< Where this event is located in the queue */ - bool isMudEvent; /**< used by the memory routines */ + EVENTFUNC(*func); /**< The function called when this event comes up. */ + void *event_obj; /**< event_obj is passed to func when func is called */ + struct q_element *q_el; /**< Where this event is located in the queue */ + bool isMudEvent; /**< used by the memory routines */ }; /************************************************************************** * End event structures and defines. @@ -47,15 +47,15 @@ struct event { /** The priority queue. */ struct dg_queue { - struct q_element *head[NUM_EVENT_QUEUES]; /**< Front of each queue bucket. */ - struct q_element *tail[NUM_EVENT_QUEUES]; /**< Rear of each queue bucket. */ + struct q_element *head[NUM_EVENT_QUEUES]; /**< Front of each queue bucket. */ + struct q_element *tail[NUM_EVENT_QUEUES]; /**< Rear of each queue bucket. */ }; /** Queued elements. */ struct q_element { - void *data; /**< The event to be handled. */ - long key; /**< When the event should be handled. */ - struct q_element *prev, *next; /**< Points to other q_elements in line. */ + void *data; /**< The event to be handled. */ + long key; /**< When the event should be handled. */ + struct q_element *prev, *next; /**< Points to other q_elements in line. */ }; /************************************************************************** * End priority queue structures and defines. diff --git a/src/dg_olc.h b/src/dg_olc.h index 82098c5..f91f1cd 100644 --- a/src/dg_olc.h +++ b/src/dg_olc.h @@ -1,43 +1,43 @@ /** * @file dg_olc.h * This source file is used in extending Oasis OLC for trigedit. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This source code, which was not part of the CircleMUD legacy code, -* was created by the following people: -* $Author: Mark A. Heilpern/egreen/Welcor $ -* $Date: 2004/10/11 12:07:00$ -* $Revision: 1.0.14 $ +* was created by the following people: +* $Author: Mark A. Heilpern/egreen/Welcor $ +* $Date: 2004/10/11 12:07:00$ +* $Revision: 1.0.14 $ */ #ifndef _DG_OLC_H_ #define _DG_OLC_H_ #include "dg_scripts.h" -#define NUM_TRIG_TYPE_FLAGS 20 +#define NUM_TRIG_TYPE_FLAGS 20 /* Submodes of TRIGEDIT connectedness. */ -#define TRIGEDIT_MAIN_MENU 0 -#define TRIGEDIT_TRIGTYPE 1 -#define TRIGEDIT_CONFIRM_SAVESTRING 2 -#define TRIGEDIT_NAME 3 -#define TRIGEDIT_INTENDED 4 -#define TRIGEDIT_TYPES 5 -#define TRIGEDIT_COMMANDS 6 -#define TRIGEDIT_NARG 7 -#define TRIGEDIT_ARGUMENT 8 -#define TRIGEDIT_COPY 9 +#define TRIGEDIT_MAIN_MENU 0 +#define TRIGEDIT_TRIGTYPE 1 +#define TRIGEDIT_CONFIRM_SAVESTRING 2 +#define TRIGEDIT_NAME 3 +#define TRIGEDIT_INTENDED 4 +#define TRIGEDIT_TYPES 5 +#define TRIGEDIT_COMMANDS 6 +#define TRIGEDIT_NARG 7 +#define TRIGEDIT_ARGUMENT 8 +#define TRIGEDIT_COPY 9 -#define OLC_SCRIPT_EDIT 82766 /* arbitrary > highest possible room number */ -#define SCRIPT_MAIN_MENU 0 -#define SCRIPT_NEW_TRIGGER 1 -#define SCRIPT_DEL_TRIGGER 2 +#define OLC_SCRIPT_EDIT 82766 /* arbitrary > highest possible room number */ +#define SCRIPT_MAIN_MENU 0 +#define SCRIPT_NEW_TRIGGER 1 +#define SCRIPT_DEL_TRIGGER 2 -#define OLC_SCRIPT_EDIT_MODE(d) (OLC(d)->script_mode) /* parse input mode */ -#define OLC_SCRIPT(d) (OLC(d)->script) /* script editing */ -#define OLC_ITEM_TYPE(d) (OLC(d)->item_type) /* mob/obj/room */ +#define OLC_SCRIPT_EDIT_MODE(d) (OLC(d)->script_mode) /* parse input mode */ +#define OLC_SCRIPT(d) (OLC(d)->script) /* script editing */ +#define OLC_ITEM_TYPE(d) (OLC(d)->item_type) /* mob/obj/room */ /* prototype exported functions from dg_olc.c */ void script_save_to_disk(FILE *fp, void *item, int type); diff --git a/src/dg_scripts.h b/src/dg_scripts.h index 34434b1..8e54df0 100644 --- a/src/dg_scripts.h +++ b/src/dg_scripts.h @@ -53,8 +53,8 @@ /* mob trigger types */ #define MTRIG_GLOBAL (1 << 0) /* check even if zone empty */ #define MTRIG_RANDOM (1 << 1) /* checked randomly */ -#define MTRIG_COMMAND (1 << 2) /* character types a command */ -#define MTRIG_SPEECH (1 << 3) /* a char says a word/phrase */ +#define MTRIG_COMMAND (1 << 2) /* character types a command */ +#define MTRIG_SPEECH (1 << 3) /* a char says a word/phrase */ #define MTRIG_ACT (1 << 4) /* word or phrase sent to act */ #define MTRIG_DEATH (1 << 5) /* character dies */ #define MTRIG_GREET (1 << 6) /* something enters room seen */ @@ -63,7 +63,7 @@ #define MTRIG_RECEIVE (1 << 9) /* character is given obj */ #define MTRIG_FIGHT (1 << 10) /* each pulse while fighting */ #define MTRIG_HITPRCNT (1 << 11) /* fighting and below some hp */ -#define MTRIG_BRIBE (1 << 12) /* coins are given to mob */ +#define MTRIG_BRIBE (1 << 12) /* coins are given to mob */ #define MTRIG_LOAD (1 << 13) /* the mob is loaded */ #define MTRIG_MEMORY (1 << 14) /* mob see's someone remembered */ #define MTRIG_CAST (1 << 15) /* mob targetted by spell */ @@ -73,8 +73,8 @@ #define MTRIG_TIME (1 << 19) /* trigger based on game hour */ /* obj trigger types */ -#define OTRIG_GLOBAL (1 << 0) /* unused */ -#define OTRIG_RANDOM (1 << 1) /* checked randomly */ +#define OTRIG_GLOBAL (1 << 0) /* unused */ +#define OTRIG_RANDOM (1 << 1) /* checked randomly */ #define OTRIG_COMMAND (1 << 2) /* character types a command */ #define OTRIG_TIMER (1 << 5) /* item's timer expires */ @@ -94,12 +94,12 @@ /* wld trigger types */ #define WTRIG_GLOBAL (1 << 0) /* check even if zone empty */ -#define WTRIG_RANDOM (1 << 1) /* checked randomly */ -#define WTRIG_COMMAND (1 << 2) /* character types a command */ +#define WTRIG_RANDOM (1 << 1) /* checked randomly */ +#define WTRIG_COMMAND (1 << 2) /* character types a command */ #define WTRIG_SPEECH (1 << 3) /* a char says word/phrase */ #define WTRIG_RESET (1 << 5) /* zone has been reset */ -#define WTRIG_ENTER (1 << 6) /* character enters room */ +#define WTRIG_ENTER (1 << 6) /* character enters room */ #define WTRIG_DROP (1 << 7) /* something dropped in room */ #define WTRIG_CAST (1 << 15) /* spell cast in room */ @@ -109,41 +109,40 @@ #define WTRIG_TIME (1 << 19) /* trigger based on game hour */ /* obj command trigger types */ -#define OCMD_EQUIP (1 << 0) /* obj must be in char's equip */ -#define OCMD_INVEN (1 << 1) /* obj must be in char's inven */ -#define OCMD_ROOM (1 << 2) /* obj must be in char's room */ +#define OCMD_EQUIP (1 << 0) /* obj must be in char's equip */ +#define OCMD_INVEN (1 << 1) /* obj must be in char's inven */ +#define OCMD_ROOM (1 << 2) /* obj must be in char's room */ /* obj consume trigger commands */ #define OCMD_EAT 1 #define OCMD_DRINK 2 #define OCMD_QUAFF 3 -#define TRIG_NEW 0 /* trigger starts from top */ -#define TRIG_RESTART 1 /* trigger restarting */ +#define TRIG_NEW 0 /* trigger starts from top */ +#define TRIG_RESTART 1 /* trigger restarting */ /* These are slightly off of PULSE_MOBILE so everything isnt happening at the * same time. */ #define PULSE_DG_SCRIPT (13 RL_SEC) -#define MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can - recurse into each other */ +#define MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can recurse into each other */ #define SCRIPT_ERROR_CODE -9999999 /* this shouldn't happen too often */ /* one line of the trigger */ struct cmdlist_element { - char *cmd; /* one line of a trigger */ - struct cmdlist_element *original; - struct cmdlist_element *next; - int loops; /* for counting number of runs in a while loop */ + char *cmd; /* one line of a trigger */ + struct cmdlist_element *original; + struct cmdlist_element *next; + int loops; /* for counting number of runs in a while loop */ }; struct trig_var_data { - char *name; /* name of variable */ - char *value; /* value of variable */ - long context; /* 0: global context */ + char *name; /* name of variable */ + char *value; /* value of variable */ + long context; /* 0: global context */ - struct trig_var_data *next; + struct trig_var_data *next; }; /** structure for triggers */ @@ -154,14 +153,14 @@ struct trig_data { char *name; /**< name of trigger */ long trigger_type; /**< type of trigger (for bitvector) */ struct cmdlist_element *cmdlist; /**< top of command list */ - struct cmdlist_element *curr_state; /**< ptr to current line of trigger */ + struct cmdlist_element *curr_state; /**< ptr to current line of trigger */ int narg; /**< numerical argument */ char *arglist; /**< argument list */ int depth; /**< depth into nest ifs/whiles/etc */ int loops; /**< loop iteration counter */ struct event *wait_event; /**< event to pause the trigger */ ubyte purged; /**< trigger is set to be purged */ - struct trig_var_data *var_list; /**< list of local vars for trigger */ + struct trig_var_data *var_list; /**< list of local vars for trigger */ struct trig_data *next; struct trig_data *next_in_world; /**< next in the global trigger list */ @@ -169,27 +168,27 @@ struct trig_data { /** a complete script (composed of several triggers) */ struct script_data { - long types; /**< bitvector of trigger types */ - struct trig_data *trig_list; /**< list of triggers */ - struct trig_var_data *global_vars; /**< list of global variables */ - ubyte purged; /**< script is set to be purged */ - long context; /**< current context for statics */ + long types; /**< bitvector of trigger types */ + struct trig_data *trig_list; /**< list of triggers */ + struct trig_var_data *global_vars; /**< list of global variables */ + ubyte purged; /**< script is set to be purged */ + long context; /**< current context for statics */ - struct script_data *next; /**< used for purged_scripts */ + struct script_data *next; /**< used for purged_scripts */ }; /* The event data for the wait command */ struct wait_event_data { - struct trig_data *trigger; - void *go; - int type; + struct trig_data *trigger; + void *go; + int type; }; /* used for actor memory triggers */ struct script_memory { - long id; /* id of who to remember */ - char *cmd; /* command, or NULL for generic */ - struct script_memory *next; + long id; /* id of who to remember */ + char *cmd; /* command, or NULL for generic */ + struct script_memory *next; }; /* typedefs that the dg functions rely on */ @@ -205,8 +204,8 @@ char *one_phrase(char *arg, char *first_arg); int is_substring(char *sub, char *string); int word_check(char *str, char *wordlist); -void act_mtrigger(const char_data *ch, char *str, - char_data *actor, char_data *victim, obj_data *object, obj_data *target, char *arg); +void act_mtrigger(const char_data *ch, char *str, char_data *actor, char_data *victim, obj_data *object, + obj_data *target, char *arg); void speech_mtrigger(char_data *actor, char *str); void speech_wtrigger(char_data *actor, char *str); void greet_memory_mtrigger(char_data *ch); @@ -218,17 +217,13 @@ int drop_otrigger(obj_data *obj, char_data *actor); void timer_otrigger(obj_data *obj); int get_otrigger(obj_data *obj, char_data *actor); int drop_wtrigger(obj_data *obj, char_data *actor); -int give_otrigger(obj_data *obj, char_data *actor, - char_data *victim); -int receive_mtrigger(char_data *ch, char_data *actor, - obj_data *obj); -void bribe_mtrigger(char_data *ch, char_data *actor, - int amount); +int give_otrigger(obj_data *obj, char_data *actor, char_data *victim); +int receive_mtrigger(char_data *ch, char_data *actor, obj_data *obj); +void bribe_mtrigger(char_data *ch, char_data *actor, int amount); int wear_otrigger(obj_data *obj, char_data *actor, int where); int remove_otrigger(obj_data *obj, char_data *actor); -int cmd_otrig(obj_data *obj, char_data *actor, char *cmd, - char *argument, int type); +int cmd_otrig(obj_data *obj, char_data *actor, char *cmd, char *argument, int type); int command_mtrigger(char_data *actor, char *cmd, char *argument); int command_otrigger(char_data *actor, char *cmd, char *argument); int command_wtrigger(char_data *actor, char *cmd, char *argument); @@ -308,8 +303,7 @@ int trig_is_attached(struct script_data *sc, int trig_num); /* Thanks to Chris Gilbert for reminding me that there are other options. */ int script_driver(void *go_adress, trig_data *trig, int type, int mode); trig_rnum real_trigger(trig_vnum vnum); -void process_eval(void *go, struct script_data *sc, trig_data *trig, - int type, char *cmd); +void process_eval(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd); void read_saved_vars(struct char_data *ch); void save_char_vars(struct char_data *ch); void init_lookup_table(void); @@ -329,12 +323,10 @@ void add_var(struct trig_var_data **var_list, const char *name, const char *valu int item_in_list(char *item, obj_data *list); char *skill_percent(struct char_data *ch, char *skill); int char_has_item(char *item, struct char_data *ch); -void var_subst(void *go, struct script_data *sc, trig_data *trig, - int type, char *line, char *buf); -int text_processed(char *field, char *subfield, struct trig_var_data *vd, - char *str, size_t slen); -void find_replacement(void *go, struct script_data *sc, trig_data *trig, - int type, char *var, char *field, char *subfield, char *str, size_t slen); +void var_subst(void *go, struct script_data *sc, trig_data *trig, int type, char *line, char *buf); +int text_processed(char *field, char *subfield, struct trig_var_data *vd, char *str, size_t slen); +void find_replacement(void *go, struct script_data *sc, trig_data *trig, int type, char *var, char *field, + char *subfield, char *str, size_t slen); /* From dg_handler.c */ void free_var_el(struct trig_var_data *var); @@ -355,10 +347,8 @@ void sub_write(char *arg, char_data *ch, byte find_invis, int targets); void send_to_zone(char *messg, zone_rnum zone); /* from dg_misc.c */ -void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, - int type, char *cmd); -void do_dg_affect(void *go, struct script_data *sc, trig_data *trig, - int type, char *cmd); +void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd); +void do_dg_affect(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd); void send_char_pos(struct char_data *ch, int dam); int valid_dg_target(char_data *ch, int bitvector); void script_damage(char_data *vict, int dam); @@ -407,13 +397,13 @@ void wld_command_interpreter(room_data *room, char *argument); #define UID_CHAR '}' #define GET_TRIG_NAME(t) ((t)->name) #define GET_TRIG_RNUM(t) ((t)->nr) -#define GET_TRIG_VNUM(t) (trig_index[(t)->nr]->vnum) +#define GET_TRIG_VNUM(t) (trig_index[(t)->nr]->vnum) #define GET_TRIG_TYPE(t) ((t)->trigger_type) -#define GET_TRIG_DATA_TYPE(t) ((t)->data_type) +#define GET_TRIG_DATA_TYPE(t) ((t)->data_type) #define GET_TRIG_NARG(t) ((t)->narg) #define GET_TRIG_ARG(t) ((t)->arglist) -#define GET_TRIG_VARS(t) ((t)->var_list) -#define GET_TRIG_WAIT(t) ((t)->wait_event) +#define GET_TRIG_VARS(t) ((t)->var_list) +#define GET_TRIG_WAIT(t) ((t)->wait_event) #define GET_TRIG_DEPTH(t) ((t)->depth) #define GET_TRIG_LOOPS(t) ((t)->loops) @@ -421,22 +411,20 @@ void wld_command_interpreter(room_data *room, char *argument); * mob id's: MOB_ID_BASE to ROOM_ID_BASE - 1 * room id's: ROOM_ID_BASE to OBJ_ID_BASE - 1 * object id's: OBJ_ID_BASE and higher */ -#define MOB_ID_BASE 10000000 /* 10000000 player IDNUMS should suffice */ -#define ROOM_ID_BASE (10000000 + MOB_ID_BASE) /* 10000000 Mobs */ -#define OBJ_ID_BASE (10000000 + ROOM_ID_BASE) /* 10000000 Rooms */ +#define MOB_ID_BASE 10000000 /* 10000000 player IDNUMS should suffice */ +#define ROOM_ID_BASE (10000000 + MOB_ID_BASE) /* 10000000 Mobs */ +#define OBJ_ID_BASE (10000000 + ROOM_ID_BASE) /* 10000000 Rooms */ -#define SCRIPT(o) ((o)->script) -#define SCRIPT_MEM(c) ((c)->memory) +#define SCRIPT(o) ((o)->script) +#define SCRIPT_MEM(c) ((c)->memory) -#define SCRIPT_TYPES(s) ((s)->types) -#define TRIGGERS(s) ((s)->trig_list) +#define SCRIPT_TYPES(s) ((s)->types) +#define TRIGGERS(s) ((s)->trig_list) -#define GET_SHORT(ch) ((ch)->player.short_descr) +#define GET_SHORT(ch) ((ch)->player.short_descr) -#define SCRIPT_CHECK(go, type) (SCRIPT(go) && \ - IS_SET(SCRIPT_TYPES(SCRIPT(go)), type)) -#define TRIGGER_CHECK(t, type) (IS_SET(GET_TRIG_TYPE(t), type) && \ - !GET_TRIG_DEPTH(t)) +#define SCRIPT_CHECK(go, type) (SCRIPT(go) && IS_SET(SCRIPT_TYPES(SCRIPT(go)), type)) +#define TRIGGER_CHECK(t, type) (IS_SET(GET_TRIG_TYPE(t), type) && !GET_TRIG_DEPTH(t)) /* This formerly used 'go' instead of 'id' and referenced 'go->id' but this is @@ -444,8 +432,8 @@ void wld_command_interpreter(room_data *room, char *argument); * and obj_script_id(). */ #define ADD_UID_VAR(buf, trig, id, name, context) do { \ - sprintf(buf, "%c%ld", UID_CHAR, id); \ - add_var(&GET_TRIG_VARS(trig), name, buf, context); } while (0) + sprintf(buf, "%c%ld", UID_CHAR, id); \ + add_var(&GET_TRIG_VARS(trig), name, buf, context); } while (0) // id helpers extern long char_script_id(char_data *ch); diff --git a/src/fight.h b/src/fight.h index e24bc16..65d8b59 100644 --- a/src/fight.h +++ b/src/fight.h @@ -1,12 +1,12 @@ /** * @file fight.h * Fighting and violence functions and variables. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * */ @@ -16,8 +16,8 @@ /* Structures and defines */ /* Attacktypes with grammar */ struct attack_hit_type { - const char *singular; - const char *plural; + const char *singular; + const char *plural; }; /* Functions available in fight.c */ @@ -31,8 +31,7 @@ void hit(struct char_data *ch, struct char_data *victim, int type); void perform_violence(void); void raw_kill(struct char_data * ch, struct char_data * killer); void set_fighting(struct char_data *ch, struct char_data *victim); -int skill_message(int dam, struct char_data *ch, struct char_data *vict, - int attacktype); +int skill_message(int dam, struct char_data *ch, struct char_data *vict, int attacktype); void stop_fighting(struct char_data *ch); diff --git a/src/genmob.h b/src/genmob.h index 50bc717..e80426f 100644 --- a/src/genmob.h +++ b/src/genmob.h @@ -1,13 +1,13 @@ /** * @file genmob.h * Generic OLC Library - Mobiles. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This source code, which was not part of the CircleMUD legacy code, * is attributed to: -* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. */ #ifndef _GENMOB_H_ #define _GENMOB_H_ @@ -31,12 +31,12 @@ int write_mobile_mobprog(mob_vnum mvnum, struct char_data *mob, FILE *fd); #endif /* Handy macros. */ -#define GET_NDD(mob) ((mob)->mob_specials.damnodice) -#define GET_SDD(mob) ((mob)->mob_specials.damsizedice) -#define GET_ALIAS(mob) ((mob)->player.name) -#define GET_SDESC(mob) ((mob)->player.short_descr) -#define GET_LDESC(mob) ((mob)->player.long_descr) -#define GET_DDESC(mob) ((mob)->player.description) -#define GET_ATTACK(mob) ((mob)->mob_specials.attack_type) +#define GET_NDD(mob) ((mob)->mob_specials.damnodice) +#define GET_SDD(mob) ((mob)->mob_specials.damsizedice) +#define GET_ALIAS(mob) ((mob)->player.name) +#define GET_SDESC(mob) ((mob)->player.short_descr) +#define GET_LDESC(mob) ((mob)->player.long_descr) +#define GET_DDESC(mob) ((mob)->player.description) +#define GET_ATTACK(mob) ((mob)->mob_specials.attack_type) #endif /* _GENMOB_H_ */ diff --git a/src/genobj.h b/src/genobj.h index a829efc..e890617 100644 --- a/src/genobj.h +++ b/src/genobj.h @@ -1,13 +1,13 @@ /** * @file genobj.h * Generic OLC Library - Objects. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This source code, which was not part of the CircleMUD legacy code, * is attributed to: -* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. */ #ifndef _GENOBJ_H_ #define _GENOBJ_H_ diff --git a/src/genolc.h b/src/genolc.h index efc075a..06ae75e 100644 --- a/src/genolc.h +++ b/src/genolc.h @@ -1,19 +1,19 @@ /** * @file genolc.h * Generic OLC Library - General. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This source code, which was not part of the CircleMUD legacy code, * is attributed to: -* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. */ #ifndef _GENOLC_H_ #define _GENOLC_H_ #define STRING_TERMINATOR '~' -#define CONFIG_GENOLC_MOBPROG 0 +#define CONFIG_GENOLC_MOBPROG 0 int genolc_checkstring(struct descriptor_data *d, char *arg); int remove_from_save_list(zone_vnum, int type); @@ -30,28 +30,28 @@ ACMD(do_export_zone); ACMD(do_show_save_list); struct save_list_data { - int zone; - int type; - struct save_list_data *next; + int zone; + int type; + struct save_list_data *next; }; extern struct save_list_data *save_list; /* save_list_data.type */ -#define SL_MOB 0 -#define SL_OBJ 1 -#define SL_SHP 2 -#define SL_WLD 3 -#define SL_ZON 4 -#define SL_CFG 5 +#define SL_MOB 0 +#define SL_OBJ 1 +#define SL_SHP 2 +#define SL_WLD 3 +#define SL_ZON 4 +#define SL_CFG 5 #define SL_QST 6 -#define SL_MAX 6 -#define SL_ACT SL_MAX + 1 /* must be above MAX */ +#define SL_MAX 6 +#define SL_ACT SL_MAX + 1 /* must be above MAX */ #define SL_HLP SL_MAX + 2 -#define ZCMD(zon, cmds) zone_table[(zon)].cmd[(cmds)] +#define ZCMD(zon, cmds) zone_table[(zon)].cmd[(cmds)] -#define LIMIT(var, low, high) MIN(high, MAX(var, low)) +#define LIMIT(var, low, high) MIN(high, MAX(var, low)) room_vnum genolc_zone_bottom(zone_rnum rznum); room_vnum genolc_zonep_bottom(struct zone_data *zone); diff --git a/src/genshp.h b/src/genshp.h index 1f36132..f4e515a 100644 --- a/src/genshp.h +++ b/src/genshp.h @@ -1,13 +1,13 @@ /** * @file genshp.h * Generic OLC Library - Shops. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This source code, which was not part of the CircleMUD legacy code, * is attributed to: -* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. */ #ifndef _GENSHP_H_ #define _GENSHP_H_ @@ -25,35 +25,35 @@ int save_shops(zone_rnum zone_num); shop_rnum real_shop(shop_vnum vnum); /* Handy macros. */ -#define S_NUM(i) ((i)->vnum) -#define S_KEEPER(i) ((i)->keeper) -#define S_OPEN1(i) ((i)->open1) -#define S_CLOSE1(i) ((i)->close1) -#define S_OPEN2(i) ((i)->open2) -#define S_CLOSE2(i) ((i)->close2) -#define S_BANK(i) ((i)->bankAccount) -#define S_BROKE_TEMPER(i) ((i)->temper1) -#define S_BITVECTOR(i) ((i)->bitvector) -#define S_NOTRADE(i) ((i)->with_who) -#define S_SORT(i) ((i)->lastsort) -#define S_BUYPROFIT(i) ((i)->profit_buy) -#define S_SELLPROFIT(i) ((i)->profit_sell) -#define S_FUNC(i) ((i)->func) +#define S_NUM(i) ((i)->vnum) +#define S_KEEPER(i) ((i)->keeper) +#define S_OPEN1(i) ((i)->open1) +#define S_CLOSE1(i) ((i)->close1) +#define S_OPEN2(i) ((i)->open2) +#define S_CLOSE2(i) ((i)->close2) +#define S_BANK(i) ((i)->bankAccount) +#define S_BROKE_TEMPER(i) ((i)->temper1) +#define S_BITVECTOR(i) ((i)->bitvector) +#define S_NOTRADE(i) ((i)->with_who) +#define S_SORT(i) ((i)->lastsort) +#define S_BUYPROFIT(i) ((i)->profit_buy) +#define S_SELLPROFIT(i) ((i)->profit_sell) +#define S_FUNC(i) ((i)->func) -#define S_ROOMS(i) ((i)->in_room) -#define S_PRODUCTS(i) ((i)->producing) -#define S_NAMELISTS(i) ((i)->type) -#define S_ROOM(i, num) ((i)->in_room[(num)]) -#define S_PRODUCT(i, num) ((i)->producing[(num)]) -#define S_BUYTYPE(i, num) (BUY_TYPE((i)->type[(num)])) -#define S_BUYWORD(i, num) (BUY_WORD((i)->type[(num)])) +#define S_ROOMS(i) ((i)->in_room) +#define S_PRODUCTS(i) ((i)->producing) +#define S_NAMELISTS(i) ((i)->type) +#define S_ROOM(i, num) ((i)->in_room[(num)]) +#define S_PRODUCT(i, num) ((i)->producing[(num)]) +#define S_BUYTYPE(i, num) (BUY_TYPE((i)->type[(num)])) +#define S_BUYWORD(i, num) (BUY_WORD((i)->type[(num)])) -#define S_NOITEM1(i) ((i)->no_such_item1) -#define S_NOITEM2(i) ((i)->no_such_item2) -#define S_NOCASH1(i) ((i)->missing_cash1) -#define S_NOCASH2(i) ((i)->missing_cash2) -#define S_NOBUY(i) ((i)->do_not_buy) -#define S_BUY(i) ((i)->message_buy) -#define S_SELL(i) ((i)->message_sell) +#define S_NOITEM1(i) ((i)->no_such_item1) +#define S_NOITEM2(i) ((i)->no_such_item2) +#define S_NOCASH1(i) ((i)->missing_cash1) +#define S_NOCASH2(i) ((i)->missing_cash2) +#define S_NOBUY(i) ((i)->do_not_buy) +#define S_BUY(i) ((i)->message_buy) +#define S_SELL(i) ((i)->message_sell) #endif /* _GENSHP_H_ */ diff --git a/src/genwld.h b/src/genwld.h index 923ad64..1a7e0f0 100644 --- a/src/genwld.h +++ b/src/genwld.h @@ -1,13 +1,13 @@ /** * @file genwld.h * Generic OLC Library - Rooms. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This source code, which was not part of the CircleMUD legacy code, * is attributed to: -* By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +* By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. */ #ifndef _GENWLD_H_ #define _GENWLD_H_ diff --git a/src/genzon.h b/src/genzon.h index 01b57f5..cb6112a 100644 --- a/src/genzon.h +++ b/src/genzon.h @@ -1,13 +1,13 @@ /** * @file genzon.h * Generic OLC Library - Zones. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This source code, which was not part of the CircleMUD legacy code, * is attributed to: -* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. +* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. */ #ifndef _GENZON_H_ #define _GENZON_H_ diff --git a/src/graph.h b/src/graph.h index 55d1f10..9671c85 100644 --- a/src/graph.h +++ b/src/graph.h @@ -1,13 +1,13 @@ /** * @file graph.h * Header file for Various graph algorithms. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * * @todo the functions here should perhaps be a part of another module? */ diff --git a/src/handler.h b/src/handler.h index 288d8cc..aee07f2 100644 --- a/src/handler.h +++ b/src/handler.h @@ -1,49 +1,48 @@ /** * @file handler.h * Prototypes of handling and utility functions. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. */ #ifndef _HANDLER_H_ #define _HANDLER_H_ /* handling the affected-structures */ -void affect_total(struct char_data *ch); -void affect_to_char(struct char_data *ch, struct affected_type *af); -void affect_remove(struct char_data *ch, struct affected_type *af); -void affect_from_char(struct char_data *ch, int type); -bool affected_by_spell(struct char_data *ch, int type); -void affect_join(struct char_data *ch, struct affected_type *af, -bool add_dur, bool avg_dur, bool add_mod, bool avg_mod); +void affect_total(struct char_data *ch); +void affect_to_char(struct char_data *ch, struct affected_type *af); +void affect_remove(struct char_data *ch, struct affected_type *af); +void affect_from_char(struct char_data *ch, int type); +bool affected_by_spell(struct char_data *ch, int type); +void affect_join(struct char_data *ch, struct affected_type *af, bool add_dur, bool avg_dur, bool add_mod, bool avg_mod); /* utility */ const char *money_desc(int amount); struct obj_data *create_money(int amount); -int isname(const char *str, const char *namelist); -int is_name(const char *str, const char *namelist); -char *fname(const char *namelist); -int get_number(char **name); +int isname(const char *str, const char *namelist); +int is_name(const char *str, const char *namelist); +char *fname(const char *namelist); +int get_number(char **name); /* objects */ -void obj_to_char(struct obj_data *object, struct char_data *ch); -void obj_from_char(struct obj_data *object); +void obj_to_char(struct obj_data *object, struct char_data *ch); +void obj_from_char(struct obj_data *object); -void equip_char(struct char_data *ch, struct obj_data *obj, int pos); +void equip_char(struct char_data *ch, struct obj_data *obj, int pos); struct obj_data *unequip_char(struct char_data *ch, int pos); -int invalid_align(struct char_data *ch, struct obj_data *obj); +int invalid_align(struct char_data *ch, struct obj_data *obj); -void obj_to_room(struct obj_data *object, room_rnum room); -void obj_from_room(struct obj_data *object); -void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to); -void obj_from_obj(struct obj_data *obj); -void object_list_new_owner(struct obj_data *list, struct char_data *ch); +void obj_to_room(struct obj_data *object, room_rnum room); +void obj_from_room(struct obj_data *object); +void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to); +void obj_from_obj(struct obj_data *obj); +void object_list_new_owner(struct obj_data *list, struct char_data *ch); -void extract_obj(struct obj_data *obj); +void extract_obj(struct obj_data *obj); void update_char_objects(struct char_data *ch); @@ -51,11 +50,11 @@ void update_char_objects(struct char_data *ch); struct char_data *get_char_room(char *name, int *num, room_rnum room); struct char_data *get_char_num(mob_rnum nr); -void char_from_room(struct char_data *ch); -void char_to_room(struct char_data *ch, room_rnum room); -void extract_char(struct char_data *ch); -void extract_char_final(struct char_data *ch); -void extract_pending_chars(void); +void char_from_room(struct char_data *ch); +void char_to_room(struct char_data *ch, room_rnum room); +void extract_char(struct char_data *ch); +void extract_char_final(struct char_data *ch); +void extract_pending_chars(void); /* find if character can see */ struct char_data *get_player_vis(struct char_data *ch, char *name, int *number, int inroom); @@ -71,11 +70,11 @@ struct obj_data *get_obj_in_equip_vis(struct char_data *ch, char *arg, int *numb int get_obj_pos_in_equip_vis(struct char_data *ch, char *arg, int *num, struct obj_data *equipment[]); /* find all dots */ -int find_all_dots(char *arg); +int find_all_dots(char *arg); -#define FIND_INDIV 0 -#define FIND_ALL 1 -#define FIND_ALLDOT 2 +#define FIND_INDIV 0 +#define FIND_ALL 1 +#define FIND_ALLDOT 2 /* group */ struct group_data * create_group(struct char_data * leader); @@ -84,8 +83,7 @@ void leave_group(struct char_data *ch); void join_group(struct char_data *ch, struct group_data *group); /* Generic Find */ -int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch, - struct char_data **tar_ch, struct obj_data **tar_obj); +int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch, struct char_data **tar_ch, struct obj_data **tar_obj); #define FIND_CHAR_ROOM (1 << 0) #define FIND_CHAR_WORLD (1 << 1) @@ -118,13 +116,13 @@ void clearMemory(struct char_data *ch); #define LAST_PLAYING 10 struct last_entry { - int close_type; - char hostname[256]; - char username[16]; - time_t time; - time_t close_time; - int idnum; - int punique; + int close_type; + char hostname[256]; + char username[16]; + time_t time; + time_t close_time; + int idnum; + int punique; }; void add_llog_entry(struct char_data *ch, int type); diff --git a/src/hedit.h b/src/hedit.h index e9ca52f..42a8b20 100644 --- a/src/hedit.h +++ b/src/hedit.h @@ -1,13 +1,13 @@ /** * @file hedit.h * Oasis OLC Help Editor. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * Author: Steve Wolfe, Scott Meisenholder, Rhade * All rights reserved. See license.doc for complete information. -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * */ #ifndef _HEDIT_H_ diff --git a/src/house.h b/src/house.h index 10aee3d..a4bae29 100644 --- a/src/house.h +++ b/src/house.h @@ -1,52 +1,51 @@ /** * @file house.h * Player house structures, prototypes and defines. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. */ #ifndef _HOUSE_H_ #define _HOUSE_H_ -#define MAX_HOUSES 100 -#define MAX_GUESTS 10 +#define MAX_HOUSES 100 +#define MAX_GUESTS 10 -#define HOUSE_PRIVATE 0 +#define HOUSE_PRIVATE 0 struct house_control_rec { - room_vnum vnum; /* vnum of this house */ - room_vnum atrium; /* vnum of atrium */ - sh_int exit_num; /* direction of house's exit */ - time_t built_on; /* date this house was built */ - int mode; /* mode of ownership */ - long owner; /* idnum of house's owner */ - int num_of_guests; /* how many guests for house */ - long guests[MAX_GUESTS]; /* idnums of house's guests */ - time_t last_payment; /* date of last house payment */ - long spare0; - long spare1; - long spare2; - long spare3; - long spare4; - long spare5; - long spare6; - long spare7; + room_vnum vnum; /* vnum of this house */ + room_vnum atrium; /* vnum of atrium */ + sh_int exit_num; /* direction of house's exit */ + time_t built_on; /* date this house was built */ + int mode; /* mode of ownership */ + long owner; /* idnum of house's owner */ + int num_of_guests; /* how many guests for house */ + long guests[MAX_GUESTS]; /* idnums of house's guests */ + time_t last_payment; /* date of last house payment */ + long spare0; + long spare1; + long spare2; + long spare3; + long spare4; + long spare5; + long spare6; + long spare7; }; -#define TOROOM(room, dir) (world[room].dir_option[dir] ? \ - world[room].dir_option[dir]->to_room : NOWHERE) +#define TOROOM(room, dir) (world[room].dir_option[dir] ? world[room].dir_option[dir]->to_room : NOWHERE) /* Functions in house.c made externally available */ /* Utility Functions */ -void House_boot(void); -void House_save_all(void); -int House_can_enter(struct char_data *ch, room_vnum house); -void House_crashsave(room_vnum vnum); -void House_list_guests(struct char_data *ch, int i, int quiet); +void House_boot(void); +void House_save_all(void); +int House_can_enter(struct char_data *ch, room_vnum house); +void House_crashsave(room_vnum vnum); +void House_list_guests(struct char_data *ch, int i, int quiet); int House_save(struct obj_data *obj, FILE *fp); void hcontrol_list_houses(struct char_data *ch, char *arg); /* In game Commands */ diff --git a/src/ibt.h b/src/ibt.h old mode 100755 new mode 100644 index 931806d..aa6f0a1 --- a/src/ibt.h +++ b/src/ibt.h @@ -69,19 +69,18 @@ typedef struct ibt_data IBT_DATA; break; \ } -struct ibt_data -{ - IBT_DATA *next; /**< Pointer to next IBT in the list */ - IBT_DATA *prev; /**< Pointer to previous IBT in the list */ - char *text; /**< Header Text for this IBT */ - char *body; /**< Body Text for this IBT */ - char *name; /**< Name of the person who reported this IBT */ - char *notes; /**< Resolution Notes added by Administrators */ - int level; /**< Level of the person who reported this IBT */ - room_vnum room; /**< Room in which this IBT was reported */ - long id_num; /**< The ID number of the player who logged it */ - int flags[IBT_ARRAY_MAX]; /**< IBT flags */ - long dated; /**< When the IBT what reported */ +struct ibt_data { + IBT_DATA *next; /**< Pointer to next IBT in the list */ + IBT_DATA *prev; /**< Pointer to previous IBT in the list */ + char *text; /**< Header Text for this IBT */ + char *body; /**< Body Text for this IBT */ + char *name; /**< Name of the person who reported this IBT */ + char *notes; /**< Resolution Notes added by Administrators */ + int level; /**< Level of the person who reported this IBT */ + room_vnum room; /**< Room in which this IBT was reported */ + long id_num; /**< The ID number of the player who logged it */ + int flags[IBT_ARRAY_MAX]; /**< IBT flags */ + long dated; /**< When the IBT what reported */ }; extern IBT_DATA *first_bug; diff --git a/src/improved-edit.h b/src/improved-edit.h index bd80bc9..f906ecc 100644 --- a/src/improved-edit.h +++ b/src/improved-edit.h @@ -1,21 +1,21 @@ /** * @file improved-edit.h * The basic and improved editor. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* This set of code was not originally part of the circlemud distribution. +* +* This set of code was not originally part of the circlemud distribution. */ #ifndef _IMPROVED_EDIT_H_ #define _IMPROVED_EDIT_H_ -/* This is here to allow different code for the basic and improved editor. If - * you do not wish to use the improved editor, put #if 0 below, otherwise you +/* This is here to allow different code for the basic and improved editor. If + * you do not wish to use the improved editor, put #if 0 below, otherwise you * should leave the setting at #if 1. */ -#define CONFIG_IMPROVED_EDITOR 1 +#define CONFIG_IMPROVED_EDITOR 1 -#define using_improved_editor CONFIG_IMPROVED_EDITOR +#define using_improved_editor CONFIG_IMPROVED_EDITOR void parse_edit_action(int command, char *string, struct descriptor_data *d); int improved_editor_execute(struct descriptor_data *d, char *string); @@ -29,18 +29,18 @@ void send_editor_help(struct descriptor_data *d); #define PARSE_HELP 2 #define PARSE_DELETE 3 #define PARSE_INSERT 4 -#define PARSE_LIST_NORM 5 +#define PARSE_LIST_NORM 5 #define PARSE_LIST_NUM 6 #define PARSE_EDIT 7 #define PARSE_TOGGLE 8 /* Defines for the action variable. */ -#define STRINGADD_OK 0 /* Just keep adding text. */ -#define STRINGADD_SAVE 1 /* Save current text. */ -#define STRINGADD_ABORT 2 /* Abort edit, restore old text. */ -#define STRINGADD_ACTION 4 /* Editor action, don't append \r\n. */ +#define STRINGADD_OK 0 /* Just keep adding text. */ +#define STRINGADD_SAVE 1 /* Save current text. */ +#define STRINGADD_ABORT 2 /* Abort edit, restore old text. */ +#define STRINGADD_ACTION 4 /* Editor action, don't append \r\n. */ /* Settings for formatter. */ -#define FORMAT_INDENT (1 << 0) +#define FORMAT_INDENT (1 << 0) #endif /* _IMPROVED_EDIT_H_ */ diff --git a/src/interpreter.c b/src/interpreter.c index 0dadad0..2d24431 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -61,413 +61,414 @@ struct command_info *complete_cmd_info; * dangerously destructive commands should have low priority. */ cpp_extern const struct command_info cmd_info[] = { - { "RESERVED", "", 0, 0, 0, 0 }, /* this must be first -- for specprocs */ + { "RESERVED", "", 0, 0, 0, 0 }, /* this must be first -- for specprocs */ - /* directions must come before other commands but after RESERVED */ - { "north" , "n" , POS_STANDING, do_move , 0, SCMD_NORTH }, - { "east" , "e" , POS_STANDING, do_move , 0, SCMD_EAST }, - { "south" , "s" , POS_STANDING, do_move , 0, SCMD_SOUTH }, - { "west" , "w" , POS_STANDING, do_move , 0, SCMD_WEST }, - { "up" , "u" , POS_STANDING, do_move , 0, SCMD_UP }, - { "down" , "d" , POS_STANDING, do_move , 0, SCMD_DOWN }, - { "northwest", "northw" , POS_STANDING, do_move , 0, SCMD_NW }, - { "nw" , "nw" , POS_STANDING, do_move , 0, SCMD_NW }, - { "northeast", "northe" , POS_STANDING, do_move , 0, SCMD_NE }, - { "ne" , "ne" , POS_STANDING, do_move , 0, SCMD_NE }, - { "southeast", "southe" , POS_STANDING, do_move , 0, SCMD_SE }, - { "se" , "se" , POS_STANDING, do_move , 0, SCMD_SE }, - { "southwest", "southw" , POS_STANDING, do_move , 0, SCMD_SW }, - { "sw" , "sw" , POS_STANDING, do_move , 0, SCMD_SW }, - - /* now, the main list */ - { "at" , "at" , POS_DEAD , do_at , LVL_IMMORT, 0 }, - { "advance" , "adv" , POS_DEAD , do_advance , LVL_GRGOD, 0 }, - { "aedit" , "aed" , POS_DEAD , do_oasis_aedit, LVL_GOD, 0 }, - { "alias" , "ali" , POS_DEAD , do_alias , 0, 0 }, - { "afk" , "afk" , POS_DEAD , do_gen_tog , 0, SCMD_AFK }, - { "areas" , "are" , POS_DEAD , do_areas , 0, 0 }, - { "assist" , "as" , POS_FIGHTING, do_assist , 1, 0 }, - { "ask" , "ask" , POS_RESTING , do_spec_comm, 0, SCMD_ASK }, - { "astat" , "ast" , POS_DEAD , do_astat , 0, 0 }, - { "attach" , "attach" , POS_DEAD , do_attach , LVL_BUILDER, 0 }, - { "auction" , "auc" , POS_SLEEPING, do_gen_comm , 0, SCMD_AUCTION }, - { "autoexits" , "autoex" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOEXIT }, - { "autoassist","autoass" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOASSIST }, - { "autodoor" , "autodoor", POS_DEAD , do_gen_tog , 0, SCMD_AUTODOOR }, - { "autogold" , "autogold", POS_DEAD , do_gen_tog , 0, SCMD_AUTOGOLD }, - { "autokey" , "autokey" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOKEY }, - { "autoloot" , "autoloot", POS_DEAD , do_gen_tog , 0, SCMD_AUTOLOOT }, - { "automap" , "automap" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOMAP }, - { "autosac" , "autosac" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOSAC }, - { "autosplit", "autospl" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOSPLIT }, + /* directions must come before other commands but after RESERVED */ + { "north", "n", POS_STANDING, do_move, 0, SCMD_NORTH }, + { "east", "e", POS_STANDING, do_move, 0, SCMD_EAST }, + { "south", "s", POS_STANDING, do_move, 0, SCMD_SOUTH }, + { "west", "w", POS_STANDING, do_move, 0, SCMD_WEST }, + { "up", "u", POS_STANDING, do_move, 0, SCMD_UP }, + { "down", "d", POS_STANDING, do_move, 0, SCMD_DOWN }, + { "northwest", "northw", POS_STANDING, do_move, 0, SCMD_NW }, + { "nw", "nw", POS_STANDING, do_move, 0, SCMD_NW }, + { "northeast", "northe", POS_STANDING, do_move, 0, SCMD_NE }, + { "ne", "ne", POS_STANDING, do_move, 0, SCMD_NE }, + { "southeast", "southe", POS_STANDING, do_move, 0, SCMD_SE }, + { "se", "se", POS_STANDING, do_move, 0, SCMD_SE }, + { "southwest", "southw", POS_STANDING, do_move, 0, SCMD_SW }, + { "sw", "sw", POS_STANDING, do_move, 0, SCMD_SW }, - { "backstab" , "ba" , POS_STANDING, do_backstab , 1, 0 }, - { "ban" , "ban" , POS_DEAD , do_ban , LVL_GRGOD, 0 }, - { "bandage" , "band" , POS_RESTING , do_bandage , 1, 0 }, - { "balance" , "bal" , POS_STANDING, do_not_here , 1, 0 }, - { "bash" , "bas" , POS_FIGHTING, do_bash , 1, 0 }, - { "brief" , "br" , POS_DEAD , do_gen_tog , 0, SCMD_BRIEF }, - { "buildwalk", "buildwalk", POS_STANDING, do_gen_tog , LVL_BUILDER, SCMD_BUILDWALK }, - { "buy" , "bu" , POS_STANDING, do_not_here , 0, 0 }, - { "bug" , "bug" , POS_DEAD , do_ibt , 0, SCMD_BUG }, + /* now, the main list */ + { "at", "at", POS_DEAD, do_at, LVL_IMMORT, 0 }, + { "advance", "adv", POS_DEAD, do_advance, LVL_GRGOD, 0 }, + { "aedit", "aed", POS_DEAD, do_oasis_aedit, LVL_GOD, 0 }, + { "alias", "ali", POS_DEAD, do_alias, 0, 0 }, + { "afk", "afk", POS_DEAD, do_gen_tog, 0, SCMD_AFK }, + { "areas", "are", POS_DEAD, do_areas, 0, 0 }, + { "assist", "as", POS_FIGHTING, do_assist, 1, 0 }, + { "ask", "ask", POS_RESTING, do_spec_comm, 0, SCMD_ASK }, + { "astat", "ast", POS_DEAD, do_astat, 0, 0 }, + { "attach", "attach", POS_DEAD, do_attach, LVL_BUILDER, 0 }, + { "auction", "auc", POS_SLEEPING, do_gen_comm, 0, SCMD_AUCTION }, + { "autoexits", "autoex", POS_DEAD, do_gen_tog, 0, SCMD_AUTOEXIT }, + { "autoassist","autoass", POS_DEAD, do_gen_tog, 0, SCMD_AUTOASSIST }, + { "autodoor", "autodoor", POS_DEAD, do_gen_tog, 0, SCMD_AUTODOOR }, + { "autogold", "autogold", POS_DEAD, do_gen_tog, 0, SCMD_AUTOGOLD }, + { "autokey", "autokey", POS_DEAD, do_gen_tog, 0, SCMD_AUTOKEY }, + { "autoloot", "autoloot", POS_DEAD, do_gen_tog, 0, SCMD_AUTOLOOT }, + { "automap", "automap", POS_DEAD, do_gen_tog, 0, SCMD_AUTOMAP }, + { "autosac", "autosac", POS_DEAD, do_gen_tog, 0, SCMD_AUTOSAC }, + { "autosplit", "autospl", POS_DEAD, do_gen_tog, 0, SCMD_AUTOSPLIT }, - { "cast" , "c" , POS_SITTING , do_cast , 1, 0 }, - { "cedit" , "cedit" , POS_DEAD , do_oasis_cedit, LVL_IMPL, 0 }, - { "changelog", "cha" , POS_DEAD , do_changelog, LVL_IMPL, 0 }, - { "check" , "ch" , POS_STANDING, do_not_here , 1, 0 }, - { "checkload", "checkl" , POS_DEAD , do_checkloadstatus, LVL_GOD, 0 }, - { "close" , "cl" , POS_SITTING , do_gen_door , 0, SCMD_CLOSE }, - { "clear" , "cle" , POS_DEAD , do_gen_ps , 0, SCMD_CLEAR }, - { "cls" , "cls" , POS_DEAD , do_gen_ps , 0, SCMD_CLEAR }, - { "consider" , "con" , POS_RESTING , do_consider , 0, 0 }, - { "commands" , "com" , POS_DEAD , do_commands , 0, SCMD_COMMANDS }, - { "compact" , "comp" , POS_DEAD , do_gen_tog , 0, SCMD_COMPACT }, - { "copyover" , "copyover", POS_DEAD , do_copyover , LVL_GRGOD, 0 }, - { "credits" , "cred" , POS_DEAD , do_gen_ps , 0, SCMD_CREDITS }, + { "backstab", "ba", POS_STANDING, do_backstab, 1, 0 }, + { "ban", "ban", POS_DEAD, do_ban, LVL_GRGOD, 0 }, + { "bandage", "band", POS_RESTING, do_bandage, 1, 0 }, + { "balance", "bal", POS_STANDING, do_not_here, 1, 0 }, + { "bash", "bas", POS_FIGHTING, do_bash, 1, 0 }, + { "brief", "br", POS_DEAD, do_gen_tog, 0, SCMD_BRIEF }, + { "buildwalk", "buildwalk", POS_STANDING, do_gen_tog, LVL_BUILDER, SCMD_BUILDWALK }, + { "buy", "bu", POS_STANDING, do_not_here, 0, 0 }, + { "bug", "bug", POS_DEAD, do_ibt, 0, SCMD_BUG }, - { "date" , "da" , POS_DEAD , do_date , LVL_IMMORT, SCMD_DATE }, - { "dc" , "dc" , POS_DEAD , do_dc , LVL_GOD, 0 }, - { "deposit" , "depo" , POS_STANDING, do_not_here , 1, 0 }, - { "detach" , "detach" , POS_DEAD , do_detach , LVL_BUILDER, 0 }, - { "diagnose" , "diag" , POS_RESTING , do_diagnose , 0, 0 }, - { "dig" , "dig" , POS_DEAD , do_dig , LVL_BUILDER, 0 }, - { "display" , "disp" , POS_DEAD , do_display , 0, 0 }, - { "donate" , "don" , POS_RESTING , do_drop , 0, SCMD_DONATE }, - { "drink" , "dri" , POS_RESTING , do_drink , 0, SCMD_DRINK }, - { "drop" , "dro" , POS_RESTING , do_drop , 0, SCMD_DROP }, + { "cast", "c", POS_SITTING, do_cast, 1, 0 }, + { "cedit", "cedit", POS_DEAD, do_oasis_cedit, LVL_IMPL, 0 }, + { "changelog", "cha", POS_DEAD, do_changelog, LVL_IMPL, 0 }, + { "check", "ch", POS_STANDING, do_not_here, 1, 0 }, + { "checkload", "checkl", POS_DEAD, do_checkloadstatus, LVL_GOD, 0 }, + { "close", "cl", POS_SITTING, do_gen_door, 0, SCMD_CLOSE }, + { "clear", "cle", POS_DEAD, do_gen_ps, 0, SCMD_CLEAR }, + { "cls", "cls", POS_DEAD, do_gen_ps, 0, SCMD_CLEAR }, + { "consider", "con", POS_RESTING, do_consider, 0, 0 }, + { "commands", "com", POS_DEAD, do_commands, 0, SCMD_COMMANDS }, + { "compact", "comp", POS_DEAD, do_gen_tog, 0, SCMD_COMPACT }, + { "copyover", "copyover", POS_DEAD, do_copyover, LVL_GRGOD, 0 }, + { "credits", "cred", POS_DEAD, do_gen_ps, 0, SCMD_CREDITS }, - { "eat" , "ea" , POS_RESTING , do_eat , 0, SCMD_EAT }, - { "echo" , "ec" , POS_SLEEPING, do_echo , LVL_IMMORT, SCMD_ECHO }, - { "emote" , "em" , POS_RESTING , do_echo , 0, SCMD_EMOTE }, - { ":" , ":" , POS_RESTING, do_echo , 1, SCMD_EMOTE }, - { "enter" , "ent" , POS_STANDING, do_enter , 0, 0 }, - { "equipment", "eq" , POS_SLEEPING, do_equipment, 0, 0 }, - { "exits" , "ex" , POS_RESTING , do_exits , 0, 0 }, - { "examine" , "exa" , POS_SITTING , do_examine , 0, 0 }, - { "export" , "export" , POS_DEAD , do_export_zone, LVL_IMPL, 0 }, + { "date", "da", POS_DEAD, do_date, LVL_IMMORT, SCMD_DATE }, + { "dc", "dc", POS_DEAD, do_dc, LVL_GOD, 0 }, + { "deposit", "depo", POS_STANDING, do_not_here, 1, 0 }, + { "detach", "detach", POS_DEAD, do_detach, LVL_BUILDER, 0 }, + { "diagnose", "diag", POS_RESTING, do_diagnose, 0, 0 }, + { "dig", "dig", POS_DEAD, do_dig, LVL_BUILDER, 0 }, + { "display", "disp", POS_DEAD, do_display, 0, 0 }, + { "donate", "don", POS_RESTING, do_drop, 0, SCMD_DONATE }, + { "drink", "dri", POS_RESTING, do_drink, 0, SCMD_DRINK }, + { "drop", "dro", POS_RESTING, do_drop, 0, SCMD_DROP }, - { "force" , "force" , POS_SLEEPING, do_force , LVL_GOD, 0 }, - { "fill" , "fil" , POS_STANDING, do_pour , 0, SCMD_FILL }, - { "file" , "file" , POS_SLEEPING, do_file , LVL_GOD, 0 }, - { "flee" , "fl" , POS_FIGHTING, do_flee , 1, 0 }, - { "follow" , "fol" , POS_RESTING , do_follow , 0, 0 }, - { "freeze" , "freeze" , POS_DEAD , do_wizutil , LVL_GRGOD, SCMD_FREEZE }, + { "eat", "ea", POS_RESTING, do_eat, 0, SCMD_EAT }, + { "echo", "ec", POS_SLEEPING, do_echo, LVL_IMMORT, SCMD_ECHO }, + { "emote", "em", POS_RESTING, do_echo, 0, SCMD_EMOTE }, + { ":", ":", POS_RESTING, do_echo, 1, SCMD_EMOTE }, + { "enter", "ent", POS_STANDING, do_enter, 0, 0 }, + { "equipment", "eq", POS_SLEEPING, do_equipment, 0, 0 }, + { "exits", "ex", POS_RESTING, do_exits, 0, 0 }, + { "examine", "exa", POS_SITTING, do_examine, 0, 0 }, + { "export", "export", POS_DEAD, do_export_zone, LVL_IMPL, 0 }, - { "get" , "g" , POS_RESTING , do_get , 0, 0 }, - { "gecho" , "gecho" , POS_DEAD , do_gecho , LVL_GOD, 0 }, - { "gemote" , "gem" , POS_SLEEPING, do_gen_comm , 0, SCMD_GEMOTE }, - { "give" , "giv" , POS_RESTING , do_give , 0, 0 }, - { "goto" , "go" , POS_SLEEPING, do_goto , LVL_IMMORT, 0 }, - { "gold" , "gol" , POS_RESTING , do_gold , 0, 0 }, - { "gossip" , "gos" , POS_SLEEPING, do_gen_comm , 0, SCMD_GOSSIP }, - { "group" , "gr" , POS_RESTING , do_group , 1, 0 }, - { "grab" , "grab" , POS_RESTING , do_grab , 0, 0 }, - { "grats" , "grat" , POS_SLEEPING, do_gen_comm , 0, SCMD_GRATZ }, - { "gsay" , "gsay" , POS_SLEEPING, do_gsay , 0, 0 }, - { "gtell" , "gt" , POS_SLEEPING, do_gsay , 0, 0 }, + { "force", "force", POS_SLEEPING, do_force, LVL_GOD, 0 }, + { "fill", "fil", POS_STANDING, do_pour, 0, SCMD_FILL }, + { "file", "file", POS_SLEEPING, do_file, LVL_GOD, 0 }, + { "flee", "fl", POS_FIGHTING, do_flee, 1, 0 }, + { "follow", "fol", POS_RESTING, do_follow, 0, 0 }, + { "freeze", "freeze", POS_DEAD, do_wizutil, LVL_GRGOD, SCMD_FREEZE }, - { "help" , "h" , POS_DEAD , do_help , 0, 0 }, - { "happyhour", "ha" , POS_DEAD , do_happyhour, 0, 0 }, - { "hedit" , "hedit" , POS_DEAD , do_oasis_hedit, LVL_GOD , 0 }, - { "helpcheck", "helpch" , POS_DEAD , do_helpcheck, LVL_GOD, 0 }, - { "hide" , "hi" , POS_RESTING , do_hide , 1, 0 }, - { "hindex" , "hind" , POS_DEAD , do_hindex , 0, 0 }, - { "handbook" , "handb" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_HANDBOOK }, - { "hcontrol" , "hcontrol", POS_DEAD , do_hcontrol , LVL_GRGOD, 0 }, - { "history" , "history" , POS_DEAD , do_history, 0, 0}, - { "hit" , "hit" , POS_FIGHTING, do_hit , 0, SCMD_HIT }, - { "hold" , "hold" , POS_RESTING , do_grab , 1, 0 }, - { "holler" , "holler" , POS_RESTING , do_gen_comm , 1, SCMD_HOLLER }, - { "holylight", "holy" , POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_HOLYLIGHT }, - { "house" , "house" , POS_RESTING , do_house , 0, 0 }, + { "get", "g", POS_RESTING, do_get, 0, 0 }, + { "gecho", "gecho", POS_DEAD, do_gecho, LVL_GOD, 0 }, + { "gemote", "gem", POS_SLEEPING, do_gen_comm, 0, SCMD_GEMOTE }, + { "give", "giv", POS_RESTING, do_give, 0, 0 }, + { "goto", "go", POS_SLEEPING, do_goto, LVL_IMMORT, 0 }, + { "gold", "gol", POS_RESTING, do_gold, 0, 0 }, + { "gossip", "gos", POS_SLEEPING, do_gen_comm, 0, SCMD_GOSSIP }, + { "group", "gr", POS_RESTING, do_group, 1, 0 }, + { "grab", "grab", POS_RESTING, do_grab, 0, 0 }, + { "grats", "grat", POS_SLEEPING, do_gen_comm, 0, SCMD_GRATZ }, + { "gsay", "gsay", POS_SLEEPING, do_gsay, 0, 0 }, + { "gtell", "gt", POS_SLEEPING, do_gsay, 0, 0 }, - { "inventory", "i" , POS_DEAD , do_inventory, 0, 0 }, - { "identify" , "id" , POS_STANDING, do_not_here , 1, 0 }, - { "idea" , "ide" , POS_DEAD , do_ibt , 0, SCMD_IDEA }, - { "imotd" , "imo" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_IMOTD }, - { "immlist" , "imm" , POS_DEAD , do_gen_ps , 0, SCMD_IMMLIST }, - { "info" , "info" , POS_SLEEPING, do_gen_ps , 0, SCMD_INFO }, - { "invis" , "invi" , POS_DEAD , do_invis , LVL_IMMORT, 0 }, + { "help", "h", POS_DEAD, do_help, 0, 0 }, + { "happyhour", "ha", POS_DEAD, do_happyhour, 0, 0 }, + { "hedit", "hedit", POS_DEAD, do_oasis_hedit, LVL_GOD, 0 }, + { "helpcheck", "helpch", POS_DEAD, do_helpcheck, LVL_GOD, 0 }, + { "hide", "hi", POS_RESTING, do_hide, 1, 0 }, + { "hindex", "hind", POS_DEAD, do_hindex, 0, 0 }, + { "handbook", "handb", POS_DEAD, do_gen_ps, LVL_IMMORT, SCMD_HANDBOOK }, + { "hcontrol", "hcontrol", POS_DEAD, do_hcontrol, LVL_GRGOD, 0 }, + { "history", "history", POS_DEAD, do_history, 0, 0}, + { "hit", "hit", POS_FIGHTING, do_hit, 0, SCMD_HIT }, + { "hold", "hold", POS_RESTING, do_grab, 1, 0 }, + { "holler", "holler", POS_RESTING, do_gen_comm, 1, SCMD_HOLLER }, + { "holylight", "holy", POS_DEAD, do_gen_tog, LVL_IMMORT, SCMD_HOLYLIGHT }, + { "house", "house", POS_RESTING, do_house, 0, 0 }, - { "junk" , "j" , POS_RESTING , do_drop , 0, SCMD_JUNK }, + { "inventory", "i", POS_DEAD, do_inventory, 0, 0 }, + { "identify", "id", POS_STANDING, do_not_here, 1, 0 }, + { "idea", "ide", POS_DEAD, do_ibt, 0, SCMD_IDEA }, + { "imotd", "imo", POS_DEAD, do_gen_ps, LVL_IMMORT, SCMD_IMOTD }, + { "immlist", "imm", POS_DEAD, do_gen_ps, 0, SCMD_IMMLIST }, + { "info", "info", POS_SLEEPING, do_gen_ps, 0, SCMD_INFO }, + { "invis", "invi", POS_DEAD, do_invis, LVL_IMMORT, 0 }, - { "kill" , "k" , POS_FIGHTING, do_kill , 0, 0 }, - { "kick" , "ki" , POS_FIGHTING, do_kick , 1, 0 }, + { "junk", "j", POS_RESTING, do_drop, 0, SCMD_JUNK }, - { "look" , "l" , POS_RESTING , do_look , 0, SCMD_LOOK }, - { "last" , "last" , POS_DEAD , do_last , LVL_GOD, 0 }, - { "leave" , "lea" , POS_STANDING, do_leave , 0, 0 }, - { "levels" , "lev" , POS_DEAD , do_levels , 0, 0 }, - { "list" , "lis" , POS_STANDING, do_not_here , 0, 0 }, - { "links" , "lin" , POS_STANDING, do_links , LVL_GOD, 0 }, - { "lock" , "loc" , POS_SITTING , do_gen_door , 0, SCMD_LOCK }, - { "load" , "load" , POS_DEAD , do_load , LVL_BUILDER, 0 }, + { "kill", "k", POS_FIGHTING, do_kill, 0, 0 }, + { "kick", "ki", POS_FIGHTING, do_kick, 1, 0 }, - { "motd" , "motd" , POS_DEAD , do_gen_ps , 0, SCMD_MOTD }, - { "mail" , "mail" , POS_STANDING, do_not_here , 1, 0 }, - { "map" , "map" , POS_STANDING, do_map , 1, 0 }, - { "medit" , "med" , POS_DEAD , do_oasis_medit, LVL_BUILDER, 0 }, - { "mlist" , "mlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_MLIST }, - { "mcopy" , "mcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_MEDIT }, - { "msgedit" , "msgedit" , POS_DEAD , do_msgedit, LVL_GOD, 0 }, - { "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_MUTE }, + { "look", "l", POS_RESTING, do_look, 0, SCMD_LOOK }, + { "last", "last", POS_DEAD, do_last, LVL_GOD, 0 }, + { "leave", "lea", POS_STANDING, do_leave, 0, 0 }, + { "levels", "lev", POS_DEAD, do_levels, 0, 0 }, + { "list", "lis", POS_STANDING, do_not_here, 0, 0 }, + { "links", "lin", POS_STANDING, do_links, LVL_GOD, 0 }, + { "lock", "loc", POS_SITTING, do_gen_door, 0, SCMD_LOCK }, + { "load", "load", POS_DEAD, do_load, LVL_BUILDER, 0 }, - { "news" , "news" , POS_SLEEPING, do_gen_ps , 0, SCMD_NEWS }, - { "noauction", "noauction",POS_DEAD , do_gen_tog , 0, SCMD_NOAUCTION }, - { "nogossip" , "nogossip", POS_DEAD , do_gen_tog , 0, SCMD_NOGOSSIP }, - { "nograts" , "nograts" , POS_DEAD , do_gen_tog , 0, SCMD_NOGRATZ }, - { "nohassle" , "nohassle", POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_NOHASSLE }, - { "norepeat" , "norepeat", POS_DEAD , do_gen_tog , 0, SCMD_NOREPEAT }, - { "noshout" , "noshout" , POS_SLEEPING, do_gen_tog , 1, SCMD_NOSHOUT }, - { "nosummon" , "nosummon", POS_DEAD , do_gen_tog , 1, SCMD_NOSUMMON }, - { "notell" , "notell" , POS_DEAD , do_gen_tog , 1, SCMD_NOTELL }, - { "notitle" , "notitle" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_NOTITLE }, - { "nowiz" , "nowiz" , POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_NOWIZ }, + { "motd", "motd", POS_DEAD, do_gen_ps, 0, SCMD_MOTD }, + { "mail", "mail", POS_STANDING, do_not_here, 1, 0 }, + { "map", "map", POS_STANDING, do_map, 1, 0 }, + { "medit", "med", POS_DEAD, do_oasis_medit, LVL_BUILDER, 0 }, + { "mlist", "mlist", POS_DEAD, do_oasis_list, LVL_BUILDER, SCMD_OASIS_MLIST }, + { "mcopy", "mcopy", POS_DEAD, do_oasis_copy, LVL_GOD, CON_MEDIT }, + { "msgedit", "msgedit", POS_DEAD, do_msgedit, LVL_GOD, 0 }, + { "mute", "mute", POS_DEAD, do_wizutil, LVL_GOD, SCMD_MUTE }, - { "open" , "o" , POS_SITTING , do_gen_door , 0, SCMD_OPEN }, - { "order" , "ord" , POS_RESTING , do_order , 1, 0 }, - { "offer" , "off" , POS_STANDING, do_not_here , 1, 0 }, - { "olc" , "olc" , POS_DEAD , do_show_save_list, LVL_BUILDER, 0 }, - { "olist" , "olist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_OLIST }, - { "oedit" , "oedit" , POS_DEAD , do_oasis_oedit, LVL_BUILDER, 0 }, - { "oset" , "oset" , POS_DEAD , do_oset, LVL_BUILDER, 0 }, - { "ocopy" , "ocopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_OEDIT }, + { "news", "news", POS_SLEEPING, do_gen_ps, 0, SCMD_NEWS }, + { "noauction", "noauction",POS_DEAD, do_gen_tog, 0, SCMD_NOAUCTION }, + { "nogossip", "nogossip", POS_DEAD, do_gen_tog, 0, SCMD_NOGOSSIP }, + { "nograts", "nograts", POS_DEAD, do_gen_tog, 0, SCMD_NOGRATZ }, + { "nohassle", "nohassle", POS_DEAD, do_gen_tog, LVL_IMMORT, SCMD_NOHASSLE }, + { "norepeat", "norepeat", POS_DEAD, do_gen_tog, 0, SCMD_NOREPEAT }, + { "noshout", "noshout", POS_SLEEPING, do_gen_tog, 1, SCMD_NOSHOUT }, + { "nosummon", "nosummon", POS_DEAD, do_gen_tog, 1, SCMD_NOSUMMON }, + { "notell", "notell", POS_DEAD, do_gen_tog, 1, SCMD_NOTELL }, + { "notitle", "notitle", POS_DEAD, do_wizutil, LVL_GOD, SCMD_NOTITLE }, + { "nowiz", "nowiz", POS_DEAD, do_gen_tog, LVL_IMMORT, SCMD_NOWIZ }, - { "put" , "p" , POS_RESTING , do_put , 0, 0 }, - { "peace" , "pe" , POS_DEAD , do_peace , LVL_BUILDER, 0 }, - { "pick" , "pi" , POS_STANDING, do_gen_door , 1, SCMD_PICK }, - { "practice" , "pr" , POS_RESTING , do_practice , 1, 0 }, - { "page" , "pag" , POS_DEAD , do_page , 1, 0 }, - { "pardon" , "pardon" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_PARDON }, - { "plist" , "plist" , POS_DEAD , do_plist , LVL_GOD, 0 }, - { "policy" , "pol" , POS_DEAD , do_gen_ps , 0, SCMD_POLICIES }, - { "pour" , "pour" , POS_STANDING, do_pour , 0, SCMD_POUR }, - { "prompt" , "pro" , POS_DEAD , do_display , 0, 0 }, - { "prefedit" , "pre" , POS_DEAD , do_oasis_prefedit , 0, 0 }, - { "purge" , "purge" , POS_DEAD , do_purge , LVL_BUILDER, 0 }, + { "open", "o", POS_SITTING, do_gen_door, 0, SCMD_OPEN }, + { "order", "ord", POS_RESTING, do_order, 1, 0 }, + { "offer", "off", POS_STANDING, do_not_here, 1, 0 }, + { "olc", "olc", POS_DEAD, do_show_save_list, LVL_BUILDER, 0 }, + { "olist", "olist", POS_DEAD, do_oasis_list, LVL_BUILDER, SCMD_OASIS_OLIST }, + { "oedit", "oedit", POS_DEAD, do_oasis_oedit, LVL_BUILDER, 0 }, + { "oset", "oset", POS_DEAD, do_oset, LVL_BUILDER, 0 }, + { "ocopy", "ocopy", POS_DEAD, do_oasis_copy, LVL_GOD, CON_OEDIT }, - { "qedit" , "qedit" , POS_DEAD , do_oasis_qedit, LVL_BUILDER, 0 }, - { "qlist" , "qlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_QLIST }, - { "quaff" , "qua" , POS_RESTING , do_use , 0, SCMD_QUAFF }, - { "qecho" , "qec" , POS_DEAD , do_qcomm , LVL_GOD, SCMD_QECHO }, - { "quest" , "que" , POS_DEAD , do_quest , 0, 0 }, - { "qui" , "qui" , POS_DEAD , do_quit , 0, 0 }, - { "quit" , "quit" , POS_DEAD , do_quit , 0, SCMD_QUIT }, - { "qsay" , "qsay" , POS_RESTING , do_qcomm , 0, SCMD_QSAY }, + { "put", "p", POS_RESTING, do_put, 0, 0 }, + { "peace", "pe", POS_DEAD, do_peace, LVL_BUILDER, 0 }, + { "pick", "pi", POS_STANDING, do_gen_door, 1, SCMD_PICK }, + { "practice", "pr", POS_RESTING, do_practice, 1, 0 }, + { "page", "pag", POS_DEAD, do_page, 1, 0 }, + { "pardon", "pardon", POS_DEAD, do_wizutil, LVL_GOD, SCMD_PARDON }, + { "plist", "plist", POS_DEAD, do_plist, LVL_GOD, 0 }, + { "policy", "pol", POS_DEAD, do_gen_ps, 0, SCMD_POLICIES }, + { "pour", "pour", POS_STANDING, do_pour, 0, SCMD_POUR }, + { "prompt", "pro", POS_DEAD, do_display, 0, 0 }, + { "prefedit", "pre", POS_DEAD, do_oasis_prefedit, 0, 0 }, + { "purge", "purge", POS_DEAD, do_purge, LVL_BUILDER, 0 }, - { "reply" , "r" , POS_SLEEPING, do_reply , 0, 0 }, - { "rest" , "res" , POS_RESTING , do_rest , 0, 0 }, - { "read" , "rea" , POS_RESTING , do_look , 0, SCMD_READ }, - { "reload" , "reload" , POS_DEAD , do_reboot , LVL_IMPL, 0 }, - { "recite" , "reci" , POS_RESTING , do_use , 0, SCMD_RECITE }, - { "receive" , "rece" , POS_STANDING, do_not_here , 1, 0 }, - { "recent" , "recent" , POS_DEAD , do_recent , LVL_IMMORT, 0 }, - { "remove" , "rem" , POS_RESTING , do_remove , 0, 0 }, - { "rent" , "rent" , POS_STANDING, do_not_here , 1, 0 }, - { "report" , "repo" , POS_RESTING , do_report , 0, 0 }, - { "reroll" , "rero" , POS_DEAD , do_wizutil , LVL_GRGOD, SCMD_REROLL }, - { "rescue" , "resc" , POS_FIGHTING, do_rescue , 1, 0 }, - { "restore" , "resto" , POS_DEAD , do_restore , LVL_GOD, 0 }, - { "return" , "retu" , POS_DEAD , do_return , 0, 0 }, - { "redit" , "redit" , POS_DEAD , do_oasis_redit, LVL_BUILDER, 0 }, - { "rlist" , "rlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_RLIST }, - { "rcopy" , "rcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_REDIT }, - { "roomflags", "roomflags", POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_SHOWVNUMS }, + { "qedit", "qedit", POS_DEAD, do_oasis_qedit, LVL_BUILDER, 0 }, + { "qlist", "qlist", POS_DEAD, do_oasis_list, LVL_BUILDER, SCMD_OASIS_QLIST }, + { "quaff", "qua", POS_RESTING, do_use, 0, SCMD_QUAFF }, + { "qecho", "qec", POS_DEAD, do_qcomm, LVL_GOD, SCMD_QECHO }, + { "quest", "que", POS_DEAD, do_quest, 0, 0 }, + { "qui", "qui", POS_DEAD, do_quit, 0, 0 }, + { "quit", "quit", POS_DEAD, do_quit, 0, SCMD_QUIT }, + { "qsay", "qsay", POS_RESTING, do_qcomm, 0, SCMD_QSAY }, - { "sacrifice", "sac" , POS_RESTING , do_sac , 0, 0 }, - { "say" , "s" , POS_RESTING , do_say , 0, 0 }, - { "score" , "sc" , POS_DEAD , do_score , 0, 0 }, - { "scan" , "sca" , POS_RESTING , do_scan , 0, 0 }, - { "scopy" , "scopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_SEDIT }, - { "sit" , "si" , POS_RESTING , do_sit , 0, 0 }, - { "'" , "'" , POS_RESTING , do_say , 0, 0 }, - { "save" , "sav" , POS_SLEEPING, do_save , 0, 0 }, - { "saveall" , "saveall" , POS_DEAD , do_saveall , LVL_BUILDER, 0}, - { "sell" , "sell" , POS_STANDING, do_not_here , 0, 0 }, - { "sedit" , "sedit" , POS_DEAD , do_oasis_sedit, LVL_BUILDER, 0 }, - { "send" , "send" , POS_SLEEPING, do_send , LVL_GOD, 0 }, - { "set" , "set" , POS_DEAD , do_set , LVL_IMMORT, 0 }, - { "shout" , "sho" , POS_RESTING , do_gen_comm , 0, SCMD_SHOUT }, - { "show" , "show" , POS_DEAD , do_show , LVL_IMMORT, 0 }, - { "shutdow" , "shutdow" , POS_DEAD , do_shutdown , LVL_IMPL, 0 }, - { "shutdown" , "shutdown", POS_DEAD , do_shutdown , LVL_IMPL, SCMD_SHUTDOWN }, - { "sip" , "sip" , POS_RESTING , do_drink , 0, SCMD_SIP }, - { "skillset" , "skillset", POS_SLEEPING, do_skillset , LVL_GRGOD, 0 }, - { "sleep" , "sl" , POS_SLEEPING, do_sleep , 0, 0 }, - { "slist" , "slist" , POS_SLEEPING, do_oasis_list, LVL_BUILDER, SCMD_OASIS_SLIST }, - { "sneak" , "sneak" , POS_STANDING, do_sneak , 1, 0 }, - { "snoop" , "snoop" , POS_DEAD , do_snoop , LVL_GOD, 0 }, - { "socials" , "socials" , POS_DEAD , do_commands , 0, SCMD_SOCIALS }, - { "split" , "split" , POS_SITTING , do_split , 1, 0 }, - { "stand" , "st" , POS_RESTING , do_stand , 0, 0 }, - { "stat" , "stat" , POS_DEAD , do_stat , LVL_IMMORT, 0 }, - { "steal" , "ste" , POS_STANDING, do_steal , 1, 0 }, - { "switch" , "switch" , POS_DEAD , do_switch , LVL_GOD, 0 }, + { "reply", "r", POS_SLEEPING, do_reply, 0, 0 }, + { "rest", "res", POS_RESTING, do_rest, 0, 0 }, + { "read", "rea", POS_RESTING, do_look, 0, SCMD_READ }, + { "reload", "reload", POS_DEAD, do_reboot, LVL_IMPL, 0 }, + { "recite", "reci", POS_RESTING, do_use, 0, SCMD_RECITE }, + { "receive", "rece", POS_STANDING, do_not_here, 1, 0 }, + { "recent", "recent", POS_DEAD, do_recent, LVL_IMMORT, 0 }, + { "remove", "rem", POS_RESTING, do_remove, 0, 0 }, + { "rent", "rent", POS_STANDING, do_not_here, 1, 0 }, + { "report", "repo", POS_RESTING, do_report, 0, 0 }, + { "reroll", "rero", POS_DEAD, do_wizutil, LVL_GRGOD, SCMD_REROLL }, + { "rescue", "resc", POS_FIGHTING, do_rescue, 1, 0 }, + { "restore", "resto", POS_DEAD, do_restore, LVL_GOD, 0 }, + { "return", "retu", POS_DEAD, do_return, 0, 0 }, + { "redit", "redit", POS_DEAD, do_oasis_redit, LVL_BUILDER, 0 }, + { "rlist", "rlist", POS_DEAD, do_oasis_list, LVL_BUILDER, SCMD_OASIS_RLIST }, + { "rcopy", "rcopy", POS_DEAD, do_oasis_copy, LVL_GOD, CON_REDIT }, + { "roomflags", "roomflags", POS_DEAD, do_gen_tog, LVL_IMMORT, SCMD_SHOWVNUMS }, - { "tell" , "t" , POS_DEAD , do_tell , 0, 0 }, - { "take" , "ta" , POS_RESTING , do_get , 0, 0 }, - { "taste" , "tas" , POS_RESTING , do_eat , 0, SCMD_TASTE }, - { "teleport" , "tele" , POS_DEAD , do_teleport , LVL_BUILDER, 0 }, - { "tedit" , "tedit" , POS_DEAD , do_tedit , LVL_GOD, 0 }, /* XXX: Oasisify */ - { "thaw" , "thaw" , POS_DEAD , do_wizutil , LVL_GRGOD, SCMD_THAW }, - { "title" , "title" , POS_DEAD , do_title , 0, 0 }, - { "time" , "time" , POS_DEAD , do_time , 0, 0 }, - { "toggle" , "toggle" , POS_DEAD , do_toggle , 0, 0 }, - { "track" , "track" , POS_STANDING, do_track , 0, 0 }, - { "transfer" , "transfer", POS_SLEEPING, do_trans , LVL_GOD, 0 }, - { "trigedit" , "trigedit", POS_DEAD , do_oasis_trigedit, LVL_BUILDER, 0 }, - { "typo" , "typo" , POS_DEAD , do_ibt , 0, SCMD_TYPO }, - { "tlist" , "tlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_TLIST }, - { "tcopy" , "tcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_TRIGEDIT }, - { "tstat" , "tstat" , POS_DEAD , do_tstat , LVL_BUILDER, 0 }, + { "sacrifice", "sac", POS_RESTING, do_sac, 0, 0 }, + { "say", "s", POS_RESTING, do_say, 0, 0 }, + { "score", "sc", POS_DEAD, do_score, 0, 0 }, + { "scan", "sca", POS_RESTING, do_scan, 0, 0 }, + { "scopy", "scopy", POS_DEAD, do_oasis_copy, LVL_GOD, CON_SEDIT }, + { "sit", "si", POS_RESTING, do_sit, 0, 0 }, + { "'", "'", POS_RESTING, do_say, 0, 0 }, + { "save", "sav", POS_SLEEPING, do_save, 0, 0 }, + { "saveall", "saveall", POS_DEAD, do_saveall, LVL_BUILDER, 0}, + { "sell", "sell", POS_STANDING, do_not_here, 0, 0 }, + { "sedit", "sedit", POS_DEAD, do_oasis_sedit, LVL_BUILDER, 0 }, + { "send", "send", POS_SLEEPING, do_send, LVL_GOD, 0 }, + { "set", "set", POS_DEAD, do_set, LVL_IMMORT, 0 }, + { "shout", "sho", POS_RESTING, do_gen_comm, 0, SCMD_SHOUT }, + { "show", "show", POS_DEAD, do_show, LVL_IMMORT, 0 }, + { "shutdow", "shutdow", POS_DEAD, do_shutdown, LVL_IMPL, 0 }, + { "shutdown", "shutdown", POS_DEAD, do_shutdown, LVL_IMPL, SCMD_SHUTDOWN }, + { "sip", "sip", POS_RESTING, do_drink, 0, SCMD_SIP }, + { "skillset", "skillset", POS_SLEEPING, do_skillset, LVL_GRGOD, 0 }, + { "sleep", "sl", POS_SLEEPING, do_sleep, 0, 0 }, + { "slist", "slist", POS_SLEEPING, do_oasis_list, LVL_BUILDER, SCMD_OASIS_SLIST }, + { "sneak", "sneak", POS_STANDING, do_sneak, 1, 0 }, + { "snoop", "snoop", POS_DEAD, do_snoop, LVL_GOD, 0 }, + { "socials", "socials", POS_DEAD, do_commands, 0, SCMD_SOCIALS }, + { "split", "split", POS_SITTING, do_split, 1, 0 }, + { "stand", "st", POS_RESTING, do_stand, 0, 0 }, + { "stat", "stat", POS_DEAD, do_stat, LVL_IMMORT, 0 }, + { "steal", "ste", POS_STANDING, do_steal, 1, 0 }, + { "switch", "switch", POS_DEAD, do_switch, LVL_GOD, 0 }, - { "unlock" , "unlock" , POS_SITTING , do_gen_door , 0, SCMD_UNLOCK }, - { "unban" , "unban" , POS_DEAD , do_unban , LVL_GRGOD, 0 }, - { "unaffect" , "unaffect", POS_DEAD , do_wizutil , LVL_GOD, SCMD_UNAFFECT }, - { "unfollow" , "unf" , POS_RESTING , do_unfollow , 0, 0 }, - { "uptime" , "uptime" , POS_DEAD , do_date , LVL_GOD, SCMD_UPTIME }, - { "use" , "use" , POS_SITTING , do_use , 1, SCMD_USE }, - { "users" , "users" , POS_DEAD , do_users , LVL_GOD, 0 }, + { "tell", "t", POS_DEAD, do_tell, 0, 0 }, + { "take", "ta", POS_RESTING, do_get, 0, 0 }, + { "taste", "tas", POS_RESTING, do_eat, 0, SCMD_TASTE }, + { "teleport", "tele", POS_DEAD, do_teleport, LVL_BUILDER, 0 }, + { "tedit", "tedit", POS_DEAD, do_tedit, LVL_GOD, 0 }, /* XXX: Oasisify */ + { "thaw", "thaw", POS_DEAD, do_wizutil, LVL_GRGOD, SCMD_THAW }, + { "title", "title", POS_DEAD, do_title, 0, 0 }, + { "time", "time", POS_DEAD, do_time, 0, 0 }, + { "toggle", "toggle", POS_DEAD, do_toggle, 0, 0 }, + { "track", "track", POS_STANDING, do_track, 0, 0 }, + { "transfer", "transfer", POS_SLEEPING, do_trans, LVL_GOD, 0 }, + { "trigedit", "trigedit", POS_DEAD, do_oasis_trigedit, LVL_BUILDER, 0 }, + { "typo", "typo", POS_DEAD, do_ibt, 0, SCMD_TYPO }, + { "tlist", "tlist", POS_DEAD, do_oasis_list, LVL_BUILDER, SCMD_OASIS_TLIST }, + { "tcopy", "tcopy", POS_DEAD, do_oasis_copy, LVL_GOD, CON_TRIGEDIT }, + { "tstat", "tstat", POS_DEAD, do_tstat, LVL_BUILDER, 0 }, - { "value" , "val" , POS_STANDING, do_not_here , 0, 0 }, - { "version" , "ver" , POS_DEAD , do_gen_ps , 0, SCMD_VERSION }, - { "visible" , "vis" , POS_RESTING , do_visible , 1, 0 }, - { "vnum" , "vnum" , POS_DEAD , do_vnum , LVL_IMMORT, 0 }, - { "vstat" , "vstat" , POS_DEAD , do_vstat , LVL_IMMORT, 0 }, - { "vdelete" , "vdelete" , POS_DEAD , do_vdelete , LVL_BUILDER, 0 }, + { "unlock", "unlock", POS_SITTING, do_gen_door, 0, SCMD_UNLOCK }, + { "unban", "unban", POS_DEAD, do_unban, LVL_GRGOD, 0 }, + { "unaffect", "unaffect", POS_DEAD, do_wizutil, LVL_GOD, SCMD_UNAFFECT }, + { "unfollow", "unf", POS_RESTING, do_unfollow, 0, 0 }, + { "uptime", "uptime", POS_DEAD, do_date, LVL_GOD, SCMD_UPTIME }, + { "use", "use", POS_SITTING, do_use, 1, SCMD_USE }, + { "users", "users", POS_DEAD, do_users, LVL_GOD, 0 }, - { "wake" , "wake" , POS_SLEEPING, do_wake , 0, 0 }, - { "wear" , "wea" , POS_RESTING , do_wear , 0, 0 }, - { "weather" , "weather" , POS_RESTING , do_weather , 0, 0 }, - { "who" , "wh" , POS_DEAD , do_who , 0, 0 }, - { "whois" , "whoi" , POS_DEAD , do_whois , 0, 0 }, - { "whoami" , "whoami" , POS_DEAD , do_gen_ps , 0, SCMD_WHOAMI }, - { "where" , "where" , POS_RESTING , do_where , 1, 0 }, - { "whirlwind", "whirl" , POS_FIGHTING, do_whirlwind, 0, 0 }, - { "whisper" , "whisper" , POS_RESTING , do_spec_comm, 0, SCMD_WHISPER }, - { "wield" , "wie" , POS_RESTING , do_wield , 0, 0 }, - { "withdraw" , "withdraw", POS_STANDING, do_not_here , 1, 0 }, - { "wiznet" , "wiz" , POS_DEAD , do_wiznet , LVL_IMMORT, 0 }, - { ";" , ";" , POS_DEAD , do_wiznet , LVL_IMMORT, 0 }, - { "wizhelp" , "wizhelp" , POS_DEAD , do_wizhelp , LVL_IMMORT, 0 }, - { "wizlist" , "wizlist" , POS_DEAD , do_gen_ps , 0, SCMD_WIZLIST }, - { "wizupdate", "wizupde" , POS_DEAD , do_wizupdate, LVL_GRGOD, 0 }, - { "wizlock" , "wizlock" , POS_DEAD , do_wizlock , LVL_IMPL, 0 }, - { "write" , "write" , POS_STANDING, do_write , 1, 0 }, + { "value", "val", POS_STANDING, do_not_here, 0, 0 }, + { "version", "ver", POS_DEAD, do_gen_ps, 0, SCMD_VERSION }, + { "visible", "vis", POS_RESTING, do_visible, 1, 0 }, + { "vnum", "vnum", POS_DEAD, do_vnum, LVL_IMMORT, 0 }, + { "vstat", "vstat", POS_DEAD, do_vstat, LVL_IMMORT, 0 }, + { "vdelete", "vdelete", POS_DEAD, do_vdelete, LVL_BUILDER, 0 }, - { "zoneresets", "zoner" , POS_DEAD , do_gen_tog , LVL_IMPL, SCMD_ZONERESETS }, - { "zreset" , "zreset" , POS_DEAD , do_zreset , LVL_BUILDER, 0 }, - { "zedit" , "zedit" , POS_DEAD , do_oasis_zedit, LVL_BUILDER, 0 }, - { "zlist" , "zlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_ZLIST }, - { "zlock" , "zlock" , POS_DEAD , do_zlock , LVL_GOD, 0 }, - { "zunlock" , "zunlock" , POS_DEAD , do_zunlock , LVL_GOD, 0 }, - { "zcheck" , "zcheck" , POS_DEAD , do_zcheck , LVL_BUILDER, 0 }, - { "zpurge" , "zpurge" , POS_DEAD , do_zpurge , LVL_BUILDER, 0 }, + { "wake", "wake", POS_SLEEPING, do_wake, 0, 0 }, + { "wear", "wea", POS_RESTING, do_wear, 0, 0 }, + { "weather", "weather", POS_RESTING, do_weather, 0, 0 }, + { "who", "wh", POS_DEAD, do_who, 0, 0 }, + { "whois", "whoi", POS_DEAD, do_whois, 0, 0 }, + { "whoami", "whoami", POS_DEAD, do_gen_ps, 0, SCMD_WHOAMI }, + { "where", "where", POS_RESTING, do_where, 1, 0 }, + { "whirlwind", "whirl", POS_FIGHTING, do_whirlwind, 0, 0 }, + { "whisper", "whisper", POS_RESTING, do_spec_comm, 0, SCMD_WHISPER }, + { "wield", "wie", POS_RESTING, do_wield, 0, 0 }, + { "withdraw", "withdraw", POS_STANDING, do_not_here, 1, 0 }, + { "wiznet", "wiz", POS_DEAD, do_wiznet, LVL_IMMORT, 0 }, + { ";", ";", POS_DEAD, do_wiznet, LVL_IMMORT, 0 }, + { "wizhelp", "wizhelp", POS_DEAD, do_wizhelp, LVL_IMMORT, 0 }, + { "wizlist", "wizlist", POS_DEAD, do_gen_ps, 0, SCMD_WIZLIST }, + { "wizupdate", "wizupde", POS_DEAD, do_wizupdate, LVL_GRGOD, 0 }, + { "wizlock", "wizlock", POS_DEAD, do_wizlock, LVL_IMPL, 0 }, + { "write", "write", POS_STANDING, do_write, 1, 0 }, - { "\n", "zzzzzzz", 0, 0, 0, 0 } }; /* this must be last */ + { "zoneresets", "zoner", POS_DEAD, do_gen_tog, LVL_IMPL, SCMD_ZONERESETS }, + { "zreset", "zreset", POS_DEAD, do_zreset, LVL_BUILDER, 0 }, + { "zedit", "zedit", POS_DEAD, do_oasis_zedit, LVL_BUILDER, 0 }, + { "zlist", "zlist", POS_DEAD, do_oasis_list, LVL_BUILDER, SCMD_OASIS_ZLIST }, + { "zlock", "zlock", POS_DEAD, do_zlock, LVL_GOD, 0 }, + { "zunlock", "zunlock", POS_DEAD, do_zunlock, LVL_GOD, 0 }, + { "zcheck", "zcheck", POS_DEAD, do_zcheck, LVL_BUILDER, 0 }, + { "zpurge", "zpurge", POS_DEAD, do_zpurge, LVL_BUILDER, 0 }, + + { "\n", "zzzzzzz", 0, 0, 0, 0 } +}; /* this must be last */ - /* Thanks to Melzaren for this change to allow DG Scripts to be attachable - *to player's while still disallowing them to manually use the DG-Commands. */ +/* Thanks to Melzaren for this change to allow DG Scripts to be attachable + *to player's while still disallowing them to manually use the DG-Commands. */ static const struct mob_script_command_t mob_script_commands[] = { - /* DG trigger commands. minimum_level should be set to -1. */ - { "masound" , do_masound , 0 }, - { "mkill" , do_mkill , 0 }, - { "mjunk" , do_mjunk , 0 }, - { "mdamage" , do_mdamage , 0 }, - { "mdoor" , do_mdoor , 0 }, - { "mecho" , do_mecho , 0 }, - { "mrecho" , do_mrecho , 0 }, - { "mechoaround", do_mechoaround , 0 }, - { "msend" , do_msend , 0 }, - { "mload" , do_mload , 0 }, - { "mpurge" , do_mpurge , 0 }, - { "mgoto" , do_mgoto , 0 }, - { "mat" , do_mat , 0 }, - { "mteleport", do_mteleport, 0 }, - { "mforce" , do_mforce , 0 }, - { "mhunt" , do_mhunt , 0 }, - { "mremember", do_mremember, 0 }, - { "mforget" , do_mforget , 0 }, - { "mtransform", do_mtransform , 0 }, - { "mzoneecho", do_mzoneecho, 0 }, - { "mfollow" , do_mfollow , 0 }, - { "mlog" , do_mlog , 0 }, - { "\n" , do_not_here , 0 } }; - -int script_command_interpreter(struct char_data *ch, char *arg) { - /* DG trigger commands */ - - int i; - char first_arg[MAX_INPUT_LENGTH]; - char *line; - - skip_spaces(&arg); - if (!*arg) - return 0; - - line = any_one_arg(arg, first_arg); - - for (i = 0; *mob_script_commands[i].command_name != '\n'; i++) - if (!str_cmp(first_arg, mob_script_commands[i].command_name)) - break; // NB - only allow full matches. - - if (*mob_script_commands[i].command_name == '\n') - return 0; // no matching commands. - - /* Poiner to the command? */ - ((*mob_script_commands[i].command_pointer) (ch, line, 0, - mob_script_commands[i].subcmd)); - return 1; // We took care of execution. Let caller know. -} - -static const char *fill[] = -{ - "in", - "from", - "with", - "the", - "on", - "at", - "to", - "\n" + /* DG trigger commands. minimum_level should be set to -1. */ + { "masound", do_masound, 0 }, + { "mkill", do_mkill, 0 }, + { "mjunk", do_mjunk, 0 }, + { "mdamage", do_mdamage, 0 }, + { "mdoor", do_mdoor, 0 }, + { "mecho", do_mecho, 0 }, + { "mrecho", do_mrecho, 0 }, + { "mechoaround", do_mechoaround, 0 }, + { "msend", do_msend, 0 }, + { "mload", do_mload, 0 }, + { "mpurge", do_mpurge, 0 }, + { "mgoto", do_mgoto, 0 }, + { "mat", do_mat, 0 }, + { "mteleport", do_mteleport, 0 }, + { "mforce", do_mforce, 0 }, + { "mhunt", do_mhunt, 0 }, + { "mremember", do_mremember, 0 }, + { "mforget", do_mforget, 0 }, + { "mtransform", do_mtransform, 0 }, + { "mzoneecho", do_mzoneecho, 0 }, + { "mfollow", do_mfollow, 0 }, + { "mlog", do_mlog, 0 }, + { "\n", do_not_here, 0 } }; -static const char *reserved[] = +int script_command_interpreter(struct char_data *ch, char *arg) { - "a", - "an", - "self", - "me", - "all", - "room", - "someone", - "something", - "\n" + /* DG trigger commands */ + + int i; + char first_arg[MAX_INPUT_LENGTH]; + char *line; + + skip_spaces(&arg); + if (!*arg) + return 0; + + line = any_one_arg(arg, first_arg); + + for (i = 0; *mob_script_commands[i].command_name != '\n'; i++) + if (!str_cmp(first_arg, mob_script_commands[i].command_name)) + break; // NB - only allow full matches. + + if (*mob_script_commands[i].command_name == '\n') + return 0; // no matching commands. + + /* Poiner to the command? */ + ((*mob_script_commands[i].command_pointer) (ch, line, 0, + mob_script_commands[i].subcmd)); + return 1; // We took care of execution. Let caller know. +} + +static const char *fill[] = { + "in", + "from", + "with", + "the", + "on", + "at", + "to", + "\n" +}; + +static const char *reserved[] = { + "a", + "an", + "self", + "me", + "all", + "room", + "someone", + "something", + "\n" }; static int sort_commands_helper(const void *a, const void *b) { - return strcmp(complete_cmd_info[*(const int *)a].sort_as, - complete_cmd_info[*(const int *)b].sort_as); + return strcmp(complete_cmd_info[*(const int *)a].sort_as, + complete_cmd_info[*(const int *)b].sort_as); } void sort_commands(void) { - int a, num_of_cmds = 0; + int a, num_of_cmds = 0; - while (complete_cmd_info[num_of_cmds].command[0] != '\n') - num_of_cmds++; - num_of_cmds++; /* \n */ + while (complete_cmd_info[num_of_cmds].command[0] != '\n') + num_of_cmds++; + num_of_cmds++; /* \n */ - CREATE(cmd_sort_info, int, num_of_cmds); + CREATE(cmd_sort_info, int, num_of_cmds); - for (a = 0; a < num_of_cmds; a++) - cmd_sort_info[a] = a; + for (a = 0; a < num_of_cmds; a++) + cmd_sort_info[a] = a; - /* Don't sort the RESERVED or \n entries. */ - qsort(cmd_sort_info + 1, num_of_cmds - 2, sizeof(int), sort_commands_helper); + /* Don't sort the RESERVED or \n entries. */ + qsort(cmd_sort_info + 1, num_of_cmds - 2, sizeof(int), sort_commands_helper); } @@ -476,190 +477,186 @@ void sort_commands(void) * then calls the appropriate function. */ void command_interpreter(struct char_data *ch, char *argument) { - int cmd, length; - char *line; - char arg[MAX_INPUT_LENGTH]; + int cmd, length; + char *line; + char arg[MAX_INPUT_LENGTH]; - REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE); + REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE); - /* just drop to next line for hitting CR */ - skip_spaces(&argument); - if (!*argument) - return; + /* just drop to next line for hitting CR */ + skip_spaces(&argument); + if (!*argument) + return; - /* special case to handle one-character, non-alphanumeric commands; requested - * by many people so "'hi" or ";godnet test" is possible. Patch sent by Eric - * Green and Stefan Wasilewski. */ - if (!isalpha(*argument)) { - arg[0] = argument[0]; - arg[1] = '\0'; - line = argument + 1; - } else - line = any_one_arg(argument, arg); + /* special case to handle one-character, non-alphanumeric commands; requested + * by many people so "'hi" or ";godnet test" is possible. Patch sent by Eric + * Green and Stefan Wasilewski. */ + if (!isalpha(*argument)) { + arg[0] = argument[0]; + arg[1] = '\0'; + line = argument + 1; + } else + line = any_one_arg(argument, arg); - /* Since all command triggers check for valid_dg_target before acting, the levelcheck - * here has been removed. Otherwise, find the command. */ - { - int cont; /* continue the command checks */ - cont = command_wtrigger(ch, arg, line); /* any world triggers ? */ - if (!cont) cont = command_mtrigger(ch, arg, line); /* any mobile triggers ? */ - if (!cont) cont = command_otrigger(ch, arg, line); /* any object triggers ? */ - if (cont) return; /* yes, command trigger took over */ - } - - /* Allow IMPLs to switch into mobs to test the commands. */ - if (IS_NPC(ch) && ch->desc && GET_LEVEL(ch->desc->original) >= LVL_IMPL) { - if (script_command_interpreter(ch, argument)) - return; - } - - for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++) - if(complete_cmd_info[cmd].command_pointer != do_action && - !strncmp(complete_cmd_info[cmd].command, arg, length)) - if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level) - break; - - /* it's not a 'real' command, so it's a social */ - - if(*complete_cmd_info[cmd].command == '\n') - for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++) - if (complete_cmd_info[cmd].command_pointer == do_action && - !strncmp(complete_cmd_info[cmd].command, arg, length)) - if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level) - break; - - if (*complete_cmd_info[cmd].command == '\n') { - int found = 0; - send_to_char(ch, "%s", CONFIG_HUH); - - for (cmd = 0; *cmd_info[cmd].command != '\n'; cmd++) + /* Since all command triggers check for valid_dg_target before acting, the levelcheck + * here has been removed. Otherwise, find the command. */ { - if (*arg != *cmd_info[cmd].command || cmd_info[cmd].minimum_level > GET_LEVEL(ch)) - continue; - - /* Only apply levenshtein counts if the command is not a trigger command. */ - if ( (levenshtein_distance(arg, cmd_info[cmd].command) <= 2) && - (cmd_info[cmd].minimum_level >= 0) ) - { - if (!found) - { - send_to_char(ch, "\r\nDid you mean:\r\n"); - found = 1; - } - send_to_char(ch, " %s\r\n", cmd_info[cmd].command); - } + int cont; /* continue the command checks */ + cont = command_wtrigger(ch, arg, line); /* any world triggers ? */ + if (!cont) cont = command_mtrigger(ch, arg, line); /* any mobile triggers ? */ + if (!cont) cont = command_otrigger(ch, arg, line); /* any object triggers ? */ + if (cont) return; /* yes, command trigger took over */ } - } - else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_FROZEN) && GET_LEVEL(ch) < LVL_IMPL) - send_to_char(ch, "You try, but the mind-numbing cold prevents you...\r\n"); - else if (complete_cmd_info[cmd].command_pointer == NULL) - send_to_char(ch, "Sorry, that command hasn't been implemented yet.\r\n"); - else if (IS_NPC(ch) && complete_cmd_info[cmd].minimum_level >= LVL_IMMORT) - send_to_char(ch, "You can't use immortal commands while switched.\r\n"); - else if (GET_POS(ch) < complete_cmd_info[cmd].minimum_position) - switch (GET_POS(ch)) { - case POS_DEAD: - send_to_char(ch, "Lie still; you are DEAD!!! :-(\r\n"); - break; - case POS_INCAP: - case POS_MORTALLYW: - send_to_char(ch, "You are in a pretty bad shape, unable to do anything!\r\n"); - break; - case POS_STUNNED: - send_to_char(ch, "All you can do right now is think about the stars!\r\n"); - break; - case POS_SLEEPING: - send_to_char(ch, "In your dreams, or what?\r\n"); - break; - case POS_RESTING: - send_to_char(ch, "Nah... You feel too relaxed to do that..\r\n"); - break; - case POS_SITTING: - send_to_char(ch, "Maybe you should get on your feet first?\r\n"); - break; - case POS_FIGHTING: - send_to_char(ch, "No way! You're fighting for your life!\r\n"); - break; - } else if (no_specials || !special(ch, cmd, line)) - ((*complete_cmd_info[cmd].command_pointer) (ch, line, cmd, complete_cmd_info[cmd].subcmd)); + + /* Allow IMPLs to switch into mobs to test the commands. */ + if (IS_NPC(ch) && ch->desc && GET_LEVEL(ch->desc->original) >= LVL_IMPL) { + if (script_command_interpreter(ch, argument)) + return; + } + + for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++) + if(complete_cmd_info[cmd].command_pointer != do_action && + !strncmp(complete_cmd_info[cmd].command, arg, length)) + if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level) + break; + + /* it's not a 'real' command, so it's a social */ + + if(*complete_cmd_info[cmd].command == '\n') + for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++) + if (complete_cmd_info[cmd].command_pointer == do_action && + !strncmp(complete_cmd_info[cmd].command, arg, length)) + if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level) + break; + + if (*complete_cmd_info[cmd].command == '\n') { + int found = 0; + send_to_char(ch, "%s", CONFIG_HUH); + + for (cmd = 0; *cmd_info[cmd].command != '\n'; cmd++) { + if (*arg != *cmd_info[cmd].command || cmd_info[cmd].minimum_level > GET_LEVEL(ch)) + continue; + + /* Only apply levenshtein counts if the command is not a trigger command. */ + if ( (levenshtein_distance(arg, cmd_info[cmd].command) <= 2) && + (cmd_info[cmd].minimum_level >= 0) ) { + if (!found) { + send_to_char(ch, "\r\nDid you mean:\r\n"); + found = 1; + } + send_to_char(ch, " %s\r\n", cmd_info[cmd].command); + } + } + } else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_FROZEN) && GET_LEVEL(ch) < LVL_IMPL) + send_to_char(ch, "You try, but the mind-numbing cold prevents you...\r\n"); + else if (complete_cmd_info[cmd].command_pointer == NULL) + send_to_char(ch, "Sorry, that command hasn't been implemented yet.\r\n"); + else if (IS_NPC(ch) && complete_cmd_info[cmd].minimum_level >= LVL_IMMORT) + send_to_char(ch, "You can't use immortal commands while switched.\r\n"); + else if (GET_POS(ch) < complete_cmd_info[cmd].minimum_position) + switch (GET_POS(ch)) { + case POS_DEAD: + send_to_char(ch, "Lie still; you are DEAD!!! :-(\r\n"); + break; + case POS_INCAP: + case POS_MORTALLYW: + send_to_char(ch, "You are in a pretty bad shape, unable to do anything!\r\n"); + break; + case POS_STUNNED: + send_to_char(ch, "All you can do right now is think about the stars!\r\n"); + break; + case POS_SLEEPING: + send_to_char(ch, "In your dreams, or what?\r\n"); + break; + case POS_RESTING: + send_to_char(ch, "Nah... You feel too relaxed to do that..\r\n"); + break; + case POS_SITTING: + send_to_char(ch, "Maybe you should get on your feet first?\r\n"); + break; + case POS_FIGHTING: + send_to_char(ch, "No way! You're fighting for your life!\r\n"); + break; + } else if (no_specials || !special(ch, cmd, line)) + ((*complete_cmd_info[cmd].command_pointer) (ch, line, cmd, complete_cmd_info[cmd].subcmd)); } /* Routines to handle aliasing. */ static struct alias_data *find_alias(struct alias_data *alias_list, char *str) { - while (alias_list != NULL) { - if (*str == *alias_list->alias) /* hey, every little bit counts :-) */ - if (!strcmp(str, alias_list->alias)) - return (alias_list); + while (alias_list != NULL) { + if (*str == *alias_list->alias) /* hey, every little bit counts :-) */ + if (!strcmp(str, alias_list->alias)) + return (alias_list); - alias_list = alias_list->next; - } + alias_list = alias_list->next; + } - return (NULL); + return (NULL); } void free_alias(struct alias_data *a) { - if (a->alias) - free(a->alias); - if (a->replacement) - free(a->replacement); - free(a); + if (a->alias) + free(a->alias); + if (a->replacement) + free(a->replacement); + free(a); } /* The interface to the outside world: do_alias */ ACMD(do_alias) { - char arg[MAX_INPUT_LENGTH]; - char *repl; - struct alias_data *a, *temp; + char arg[MAX_INPUT_LENGTH]; + char *repl; + struct alias_data *a, *temp; - if (IS_NPC(ch)) - return; + if (IS_NPC(ch)) + return; - repl = any_one_arg(argument, arg); + repl = any_one_arg(argument, arg); - if (!*arg) { /* no argument specified -- list currently defined aliases */ - send_to_char(ch, "Currently defined aliases:\r\n"); - if ((a = GET_ALIASES(ch)) == NULL) - send_to_char(ch, " None.\r\n"); - else { - while (a != NULL) { - send_to_char(ch, "%-15s %s\r\n", a->alias, a->replacement); - a = a->next; - } + if (!*arg) { /* no argument specified -- list currently defined aliases */ + send_to_char(ch, "Currently defined aliases:\r\n"); + if ((a = GET_ALIASES(ch)) == NULL) + send_to_char(ch, " None.\r\n"); + else { + while (a != NULL) { + send_to_char(ch, "%-15s %s\r\n", a->alias, a->replacement); + a = a->next; + } + } + } else { /* otherwise, add or remove aliases */ + /* is this an alias we've already defined? */ + if ((a = find_alias(GET_ALIASES(ch), arg)) != NULL) { + REMOVE_FROM_LIST(a, GET_ALIASES(ch), next); + free_alias(a); + } + /* if no replacement string is specified, assume we want to delete */ + if (!*repl) { + if (a == NULL) + send_to_char(ch, "No such alias.\r\n"); + else + send_to_char(ch, "Alias deleted.\r\n"); + } else { /* otherwise, either add or redefine an alias */ + if (!str_cmp(arg, "alias")) { + send_to_char(ch, "You can't alias 'alias'.\r\n"); + return; + } + CREATE(a, struct alias_data, 1); + a->alias = strdup(arg); + delete_doubledollar(repl); + a->replacement = strdup(repl); + if (strchr(repl, ALIAS_SEP_CHAR) || strchr(repl, ALIAS_VAR_CHAR)) + a->type = ALIAS_COMPLEX; + else + a->type = ALIAS_SIMPLE; + a->next = GET_ALIASES(ch); + GET_ALIASES(ch) = a; + save_char(ch); + send_to_char(ch, "Alias ready.\r\n"); + } } - } else { /* otherwise, add or remove aliases */ - /* is this an alias we've already defined? */ - if ((a = find_alias(GET_ALIASES(ch), arg)) != NULL) { - REMOVE_FROM_LIST(a, GET_ALIASES(ch), next); - free_alias(a); - } - /* if no replacement string is specified, assume we want to delete */ - if (!*repl) { - if (a == NULL) - send_to_char(ch, "No such alias.\r\n"); - else - send_to_char(ch, "Alias deleted.\r\n"); - } else { /* otherwise, either add or redefine an alias */ - if (!str_cmp(arg, "alias")) { - send_to_char(ch, "You can't alias 'alias'.\r\n"); - return; - } - CREATE(a, struct alias_data, 1); - a->alias = strdup(arg); - delete_doubledollar(repl); - a->replacement = strdup(repl); - if (strchr(repl, ALIAS_SEP_CHAR) || strchr(repl, ALIAS_VAR_CHAR)) - a->type = ALIAS_COMPLEX; - else - a->type = ALIAS_SIMPLE; - a->next = GET_ALIASES(ch); - GET_ALIASES(ch) = a; - save_char(ch); - send_to_char(ch, "Alias ready.\r\n"); - } - } } /* Valid numeric replacements are only $1 .. $9 (makes parsing a little easier, @@ -670,56 +667,56 @@ ACMD(do_alias) static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a) { - struct txt_q temp_queue; - char *tokens[NUM_TOKENS], *temp, *write_point; - char buf2[MAX_RAW_INPUT_LENGTH], buf[MAX_RAW_INPUT_LENGTH]; /* raw? */ - int num_of_tokens = 0, num; + struct txt_q temp_queue; + char *tokens[NUM_TOKENS], *temp, *write_point; + char buf2[MAX_RAW_INPUT_LENGTH], buf[MAX_RAW_INPUT_LENGTH]; /* raw? */ + int num_of_tokens = 0, num; - /* First, parse the original string */ - strcpy(buf2, orig); /* strcpy: OK (orig:MAX_INPUT_LENGTH < buf2:MAX_RAW_INPUT_LENGTH) */ - temp = strtok(buf2, " "); - while (temp != NULL && num_of_tokens < NUM_TOKENS) { - tokens[num_of_tokens++] = temp; - temp = strtok(NULL, " "); - } + /* First, parse the original string */ + strcpy(buf2, orig); /* strcpy: OK (orig:MAX_INPUT_LENGTH < buf2:MAX_RAW_INPUT_LENGTH) */ + temp = strtok(buf2, " "); + while (temp != NULL && num_of_tokens < NUM_TOKENS) { + tokens[num_of_tokens++] = temp; + temp = strtok(NULL, " "); + } - /* initialize */ - write_point = buf; - temp_queue.head = temp_queue.tail = NULL; + /* initialize */ + write_point = buf; + temp_queue.head = temp_queue.tail = NULL; - /* now parse the alias */ - for (temp = a->replacement; *temp; temp++) { - if (*temp == ALIAS_SEP_CHAR) { - *write_point = '\0'; - buf[MAX_INPUT_LENGTH - 1] = '\0'; - write_to_q(buf, &temp_queue, 1); - write_point = buf; - } else if (*temp == ALIAS_VAR_CHAR) { - temp++; - if ((num = *temp - '1') < num_of_tokens && num >= 0) { - strcpy(write_point, tokens[num]); /* strcpy: OK */ - write_point += strlen(tokens[num]); - } else if (*temp == ALIAS_GLOB_CHAR) { - skip_spaces(&orig); - strcpy(write_point, orig); /* strcpy: OK */ - write_point += strlen(orig); - } else if ((*(write_point++) = *temp) == '$') /* redouble $ for act safety */ - *(write_point++) = '$'; - } else - *(write_point++) = *temp; - } + /* now parse the alias */ + for (temp = a->replacement; *temp; temp++) { + if (*temp == ALIAS_SEP_CHAR) { + *write_point = '\0'; + buf[MAX_INPUT_LENGTH - 1] = '\0'; + write_to_q(buf, &temp_queue, 1); + write_point = buf; + } else if (*temp == ALIAS_VAR_CHAR) { + temp++; + if ((num = *temp - '1') < num_of_tokens && num >= 0) { + strcpy(write_point, tokens[num]); /* strcpy: OK */ + write_point += strlen(tokens[num]); + } else if (*temp == ALIAS_GLOB_CHAR) { + skip_spaces(&orig); + strcpy(write_point, orig); /* strcpy: OK */ + write_point += strlen(orig); + } else if ((*(write_point++) = *temp) == '$') /* redouble $ for act safety */ + *(write_point++) = '$'; + } else + *(write_point++) = *temp; + } - *write_point = '\0'; - buf[MAX_INPUT_LENGTH - 1] = '\0'; - write_to_q(buf, &temp_queue, 1); + *write_point = '\0'; + buf[MAX_INPUT_LENGTH - 1] = '\0'; + write_to_q(buf, &temp_queue, 1); - /* push our temp_queue on to the _front_ of the input queue */ - if (input_q->head == NULL) - *input_q = temp_queue; - else { - temp_queue.tail->next = input_q->head; - input_q->head = temp_queue.head; - } + /* push our temp_queue on to the _front_ of the input queue */ + if (input_q->head == NULL) + *input_q = temp_queue; + else { + temp_queue.tail->next = input_q->head; + input_q->head = temp_queue.head; + } } /* Given a character and a string, perform alias replacement on it. @@ -729,35 +726,35 @@ static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alia * have been placed at the front of the character's input queue. */ int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen) { - char first_arg[MAX_INPUT_LENGTH], *ptr; - struct alias_data *a, *tmp; + char first_arg[MAX_INPUT_LENGTH], *ptr; + struct alias_data *a, *tmp; - /* Mobs don't have alaises. */ - if (IS_NPC(d->character)) - return (0); + /* Mobs don't have alaises. */ + if (IS_NPC(d->character)) + return (0); - /* bail out immediately if the guy doesn't have any aliases */ - if ((tmp = GET_ALIASES(d->character)) == NULL) - return (0); + /* bail out immediately if the guy doesn't have any aliases */ + if ((tmp = GET_ALIASES(d->character)) == NULL) + return (0); - /* find the alias we're supposed to match */ - ptr = any_one_arg(orig, first_arg); + /* find the alias we're supposed to match */ + ptr = any_one_arg(orig, first_arg); - /* bail out if it's null */ - if (!*first_arg) - return (0); + /* bail out if it's null */ + if (!*first_arg) + return (0); - /* if the first arg is not an alias, return without doing anything */ - if ((a = find_alias(tmp, first_arg)) == NULL) - return (0); + /* if the first arg is not an alias, return without doing anything */ + if ((a = find_alias(tmp, first_arg)) == NULL) + return (0); - if (a->type == ALIAS_SIMPLE) { - strlcpy(orig, a->replacement, maxlen); - return (0); - } else { - perform_complex_alias(&d->input, ptr, a); - return (1); - } + if (a->type == ALIAS_SIMPLE) { + strlcpy(orig, a->replacement, maxlen); + return (0); + } else { + perform_complex_alias(&d->input, ptr, a); + return (1); + } } /* Various other parsing utilities. */ @@ -768,53 +765,53 @@ int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen) * '\n' so it knows to stop searching. */ int search_block(char *arg, const char **list, int exact) { - int i, l; + int i, l; + + /* We used to have \r as the first character on certain array items to + * prevent the explicit choice of that point. It seems a bit silly to + * dump control characters into arrays to prevent that, so we'll just + * check in here to see if the first character of the argument is '!', + * and if so, just blindly return a '-1' for not found. - ae. */ + if (*arg == '!') + return (-1); + + /* Make into lower case, and get length of string */ + for (l = 0; *(arg + l); l++) + *(arg + l) = LOWER(*(arg + l)); + + if (exact) { + for (i = 0; **(list + i) != '\n'; i++) + if (!strcmp(arg, *(list + i))) + return (i); + } else { + if (!l) + l = 1; /* Avoid "" to match the first available + * string */ + for (i = 0; **(list + i) != '\n'; i++) + if (!strncmp(arg, *(list + i), l)) + return (i); + } - /* We used to have \r as the first character on certain array items to - * prevent the explicit choice of that point. It seems a bit silly to - * dump control characters into arrays to prevent that, so we'll just - * check in here to see if the first character of the argument is '!', - * and if so, just blindly return a '-1' for not found. - ae. */ - if (*arg == '!') return (-1); - - /* Make into lower case, and get length of string */ - for (l = 0; *(arg + l); l++) - *(arg + l) = LOWER(*(arg + l)); - - if (exact) { - for (i = 0; **(list + i) != '\n'; i++) - if (!strcmp(arg, *(list + i))) - return (i); - } else { - if (!l) - l = 1; /* Avoid "" to match the first available - * string */ - for (i = 0; **(list + i) != '\n'; i++) - if (!strncmp(arg, *(list + i), l)) - return (i); - } - - return (-1); } int is_number(const char *str) { - if(*str == '-') - str++; - if(!*str) - return (0); - while (*str) - if (!isdigit(*(str++))) - return (0); + if(*str == '-') + str++; + if(!*str) + return (0); + while (*str) + if (!isdigit(*(str++))) + return (0); - return (1); + return (1); } /* Function to skip over the leading spaces of a string. */ void skip_spaces(char **string) { - for (; **string && **string != '\t' && isspace(**string); (*string)++); + for (; **string && **string != '\t' && isspace(**string); (*string)++); } /* Given a string, change all instances of double dollar signs ($$) to single @@ -827,61 +824,61 @@ void skip_spaces(char **string) * Modifies the string in-place. */ char *delete_doubledollar(char *string) { - char *ddread, *ddwrite; + char *ddread, *ddwrite; + + /* If the string has no dollar signs, return immediately */ + if ((ddwrite = strchr(string, '$')) == NULL) + return (string); + + /* Start from the location of the first dollar sign */ + ddread = ddwrite; + + + while (*ddread) /* Until we reach the end of the string... */ + if ((*(ddwrite++) = *(ddread++)) == '$') /* copy one char */ + if (*ddread == '$') + ddread++; /* skip if we saw 2 $'s in a row */ + + *ddwrite = '\0'; - /* If the string has no dollar signs, return immediately */ - if ((ddwrite = strchr(string, '$')) == NULL) return (string); - - /* Start from the location of the first dollar sign */ - ddread = ddwrite; - - - while (*ddread) /* Until we reach the end of the string... */ - if ((*(ddwrite++) = *(ddread++)) == '$') /* copy one char */ - if (*ddread == '$') - ddread++; /* skip if we saw 2 $'s in a row */ - - *ddwrite = '\0'; - - return (string); } int fill_word(char *argument) { - return (search_block(argument, fill, TRUE) >= 0); + return (search_block(argument, fill, TRUE) >= 0); } int reserved_word(char *argument) { - return (search_block(argument, reserved, TRUE) >= 0); + return (search_block(argument, reserved, TRUE) >= 0); } /* Copy the first non-fill-word, space-delimited argument of 'argument' * to 'first_arg'; return a pointer to the remainder of the string. */ char *one_argument(char *argument, char *first_arg) { - char *begin = first_arg; + char *begin = first_arg; - if (!argument) { - log("SYSERR: one_argument received a NULL pointer!"); - *first_arg = '\0'; - return (NULL); - } - - do { - skip_spaces(&argument); - - first_arg = begin; - while (*argument && !isspace(*argument)) { - *(first_arg++) = LOWER(*argument); - argument++; + if (!argument) { + log("SYSERR: one_argument received a NULL pointer!"); + *first_arg = '\0'; + return (NULL); } - *first_arg = '\0'; - } while (fill_word(begin)); + do { + skip_spaces(&argument); - return (argument); + first_arg = begin; + while (*argument && !isspace(*argument)) { + *(first_arg++) = LOWER(*argument); + argument++; + } + + *first_arg = '\0'; + } while (fill_word(begin)); + + return (argument); } /* one_word is like any_one_arg, except that words in quotes ("") are @@ -891,910 +888,914 @@ char *one_word(char *argument, char *first_arg) skip_spaces(&argument); if (*argument == '\"') { - argument++; - while (*argument && *argument != '\"') { - *(first_arg++) = LOWER(*argument); argument++; - } - argument++; + while (*argument && *argument != '\"') { + *(first_arg++) = LOWER(*argument); + argument++; + } + argument++; } else { - while (*argument && !isspace(*argument)) { - *(first_arg++) = LOWER(*argument); - argument++; - } + while (*argument && !isspace(*argument)) { + *(first_arg++) = LOWER(*argument); + argument++; + } } *first_arg = '\0'; - return (argument); + return (argument); } /* Same as one_argument except that it doesn't ignore fill words. */ char *any_one_arg(char *argument, char *first_arg) { - skip_spaces(&argument); + skip_spaces(&argument); - while (*argument && !isspace(*argument)) { - *(first_arg++) = LOWER(*argument); - argument++; - } + while (*argument && !isspace(*argument)) { + *(first_arg++) = LOWER(*argument); + argument++; + } - *first_arg = '\0'; + *first_arg = '\0'; - return (argument); + return (argument); } /* Same as one_argument except that it takes two args and returns the rest; * ignores fill words */ char *two_arguments(char *argument, char *first_arg, char *second_arg) { - return (one_argument(one_argument(argument, first_arg), second_arg)); /* :-) */ + return (one_argument(one_argument(argument, first_arg), second_arg)); /* :-) */ } /* Determine if a given string is an abbreviation of another. * Returns 1 if arg1 is an abbreviation of arg2. */ int is_abbrev(const char *arg1, const char *arg2) { - if (!*arg1) - return (0); + if (!*arg1) + return (0); - for (; *arg1 && *arg2; arg1++, arg2++) - if (LOWER(*arg1) != LOWER(*arg2)) - return (0); + for (; *arg1 && *arg2; arg1++, arg2++) + if (LOWER(*arg1) != LOWER(*arg2)) + return (0); - if (!*arg1) - return (1); - else - return (0); + if (!*arg1) + return (1); + else + return (0); } /* Return first space-delimited token in arg1; remainder of string in arg2. * NOTE: Requires sizeof(arg2) >= sizeof(string) */ void half_chop(char *string, char *arg1, char *arg2) { - char *temp; + char *temp; - temp = any_one_arg(string, arg1); - skip_spaces(&temp); - strcpy(arg2, temp); /* strcpy: OK (documentation) */ + temp = any_one_arg(string, arg1); + skip_spaces(&temp); + strcpy(arg2, temp); /* strcpy: OK (documentation) */ } /* Used in specprocs, mostly. (Exactly) matches "command" to cmd number */ int find_command(const char *command) { - int cmd; + int cmd; - for (cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++) - if (!strcmp(complete_cmd_info[cmd].command, command)) - return (cmd); + for (cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++) + if (!strcmp(complete_cmd_info[cmd].command, command)) + return (cmd); - return (-1); + return (-1); } int special(struct char_data *ch, int cmd, char *arg) { - struct obj_data *i; - struct char_data *k; - int j; + struct obj_data *i; + struct char_data *k; + int j; - /* special in room? */ - if (GET_ROOM_SPEC(IN_ROOM(ch)) != NULL) - if (GET_ROOM_SPEC(IN_ROOM(ch)) (ch, world + IN_ROOM(ch), cmd, arg)) - return (1); + /* special in room? */ + if (GET_ROOM_SPEC(IN_ROOM(ch)) != NULL) + if (GET_ROOM_SPEC(IN_ROOM(ch)) (ch, world + IN_ROOM(ch), cmd, arg)) + return (1); - /* special in equipment list? */ - for (j = 0; j < NUM_WEARS; j++) - if (GET_EQ(ch, j) && GET_OBJ_SPEC(GET_EQ(ch, j)) != NULL) - if (GET_OBJ_SPEC(GET_EQ(ch, j)) (ch, GET_EQ(ch, j), cmd, arg)) - return (1); + /* special in equipment list? */ + for (j = 0; j < NUM_WEARS; j++) + if (GET_EQ(ch, j) && GET_OBJ_SPEC(GET_EQ(ch, j)) != NULL) + if (GET_OBJ_SPEC(GET_EQ(ch, j)) (ch, GET_EQ(ch, j), cmd, arg)) + return (1); - /* special in inventory? */ - for (i = ch->carrying; i; i = i->next_content) - if (GET_OBJ_SPEC(i) != NULL) - if (GET_OBJ_SPEC(i) (ch, i, cmd, arg)) - return (1); + /* special in inventory? */ + for (i = ch->carrying; i; i = i->next_content) + if (GET_OBJ_SPEC(i) != NULL) + if (GET_OBJ_SPEC(i) (ch, i, cmd, arg)) + return (1); - /* special in mobile present? */ - for (k = world[IN_ROOM(ch)].people; k; k = k->next_in_room) - if (!MOB_FLAGGED(k, MOB_NOTDEADYET)) - if (GET_MOB_SPEC(k) && GET_MOB_SPEC(k) (ch, k, cmd, arg)) - return (1); + /* special in mobile present? */ + for (k = world[IN_ROOM(ch)].people; k; k = k->next_in_room) + if (!MOB_FLAGGED(k, MOB_NOTDEADYET)) + if (GET_MOB_SPEC(k) && GET_MOB_SPEC(k) (ch, k, cmd, arg)) + return (1); - /* special in object present? */ - for (i = world[IN_ROOM(ch)].contents; i; i = i->next_content) - if (GET_OBJ_SPEC(i) != NULL) - if (GET_OBJ_SPEC(i) (ch, i, cmd, arg)) - return (1); + /* special in object present? */ + for (i = world[IN_ROOM(ch)].contents; i; i = i->next_content) + if (GET_OBJ_SPEC(i) != NULL) + if (GET_OBJ_SPEC(i) (ch, i, cmd, arg)) + return (1); - return (0); + return (0); } /* Stuff for controlling the non-playing sockets (get name, pwd etc). * This function needs to die. */ static int _parse_name(char *arg, char *name) { - int i; + int i; - skip_spaces(&arg); - for (i = 0; (*name = *arg); arg++, i++, name++) - if (!isalpha(*arg)) - return (1); + skip_spaces(&arg); + for (i = 0; (*name = *arg); arg++, i++, name++) + if (!isalpha(*arg)) + return (1); - if (!i) - return (1); + if (!i) + return (1); - return (0); + return (0); } -#define RECON 1 -#define USURP 2 -#define UNSWITCH 3 +#define RECON 1 +#define USURP 2 +#define UNSWITCH 3 /* This function seems a bit over-extended. */ static int perform_dupe_check(struct descriptor_data *d) { - struct descriptor_data *k, *next_k; - struct char_data *target = NULL, *ch, *next_ch; - int mode = 0; - int pref_temp = 0; /* for "last" log */ - int id = GET_IDNUM(d->character); + struct descriptor_data *k, *next_k; + struct char_data *target = NULL, *ch, *next_ch; + int mode = 0; + int pref_temp = 0; /* for "last" log */ + int id = GET_IDNUM(d->character); - /* Now that this descriptor has successfully logged in, disconnect all - * other descriptors controlling a character with the same ID number. */ + /* Now that this descriptor has successfully logged in, disconnect all + * other descriptors controlling a character with the same ID number. */ - for (k = descriptor_list; k; k = next_k) { - next_k = k->next; + for (k = descriptor_list; k; k = next_k) { + next_k = k->next; - if (k == d) - continue; + if (k == d) + continue; - if (k->original && (GET_IDNUM(k->original) == id)) { - /* Original descriptor was switched, booting it and restoring normal body control. */ + if (k->original && (GET_IDNUM(k->original) == id)) { + /* Original descriptor was switched, booting it and restoring normal body control. */ - write_to_output(d, "\r\nMultiple login detected -- disconnecting.\r\n"); - STATE(k) = CON_CLOSE; - pref_temp=GET_PREF(k->character); - if (!target) { - target = k->original; - mode = UNSWITCH; - } - if (k->character) - k->character->desc = NULL; - k->character = NULL; - k->original = NULL; - } else if (k->character && GET_IDNUM(k->character) == id && k->original) { - /* Character taking over their own body, while an immortal was switched to it. */ + write_to_output(d, "\r\nMultiple login detected -- disconnecting.\r\n"); + STATE(k) = CON_CLOSE; + pref_temp=GET_PREF(k->character); + if (!target) { + target = k->original; + mode = UNSWITCH; + } + if (k->character) + k->character->desc = NULL; + k->character = NULL; + k->original = NULL; + } else if (k->character && GET_IDNUM(k->character) == id && k->original) { + /* Character taking over their own body, while an immortal was switched to it. */ - do_return(k->character, NULL, 0, 0); - } else if (k->character && GET_IDNUM(k->character) == id) { - /* Character taking over their own body. */ - pref_temp=GET_PREF(k->character); + do_return(k->character, NULL, 0, 0); + } else if (k->character && GET_IDNUM(k->character) == id) { + /* Character taking over their own body. */ + pref_temp=GET_PREF(k->character); - if (!target && STATE(k) == CON_PLAYING) { - write_to_output(k, "\r\nThis body has been usurped!\r\n"); - target = k->character; - mode = USURP; - } - k->character->desc = NULL; - k->character = NULL; - k->original = NULL; - write_to_output(k, "\r\nMultiple login detected -- disconnecting.\r\n"); - STATE(k) = CON_CLOSE; + if (!target && STATE(k) == CON_PLAYING) { + write_to_output(k, "\r\nThis body has been usurped!\r\n"); + target = k->character; + mode = USURP; + } + k->character->desc = NULL; + k->character = NULL; + k->original = NULL; + write_to_output(k, "\r\nMultiple login detected -- disconnecting.\r\n"); + STATE(k) = CON_CLOSE; + } } - } - /* Now, go through the character list, deleting all characters that are not - * already marked for deletion from the above step (i.e., in the CON_HANGUP - * state), and have not already been selected as a target for switching into. - * In addition, if we haven't already found a target, choose one if one is - * available (while still deleting the other duplicates, though theoretically - * none should be able to exist). */ - for (ch = character_list; ch; ch = next_ch) { - next_ch = ch->next; + /* Now, go through the character list, deleting all characters that are not + * already marked for deletion from the above step (i.e., in the CON_HANGUP + * state), and have not already been selected as a target for switching into. + * In addition, if we haven't already found a target, choose one if one is + * available (while still deleting the other duplicates, though theoretically + * none should be able to exist). */ + for (ch = character_list; ch; ch = next_ch) { + next_ch = ch->next; - if (IS_NPC(ch)) - continue; - if (GET_IDNUM(ch) != id) - continue; + if (IS_NPC(ch)) + continue; + if (GET_IDNUM(ch) != id) + continue; - /* ignore chars with descriptors (already handled by above step) */ - if (ch->desc) - continue; + /* ignore chars with descriptors (already handled by above step) */ + if (ch->desc) + continue; - /* don't extract the target char we've found one already */ - if (ch == target) - continue; + /* don't extract the target char we've found one already */ + if (ch == target) + continue; - /* we don't already have a target and found a candidate for switching */ + /* we don't already have a target and found a candidate for switching */ + if (!target) { + target = ch; + mode = RECON; + pref_temp = GET_PREF(ch); + continue; + } + + /* we've found a duplicate - blow him away, dumping his eq in limbo. */ + if (IN_ROOM(ch) != NOWHERE) + char_from_room(ch); + char_to_room(ch, 1); + extract_char(ch); + } + + /* no target for switching into was found - allow login to continue */ if (!target) { - target = ch; - mode = RECON; - pref_temp = GET_PREF(ch); - continue; + GET_PREF(d->character) = rand_number(1, 128000); + if (GET_HOST(d->character)) + free(GET_HOST(d->character)); + GET_HOST(d->character) = strdup(d->host); + return 0; } - /* we've found a duplicate - blow him away, dumping his eq in limbo. */ - if (IN_ROOM(ch) != NOWHERE) - char_from_room(ch); - char_to_room(ch, 1); - extract_char(ch); - } + if (GET_HOST(target)) free(GET_HOST(target)); + GET_HOST(target) = strdup(d->host); - /* no target for switching into was found - allow login to continue */ - if (!target) { - GET_PREF(d->character) = rand_number(1, 128000); - if (GET_HOST(d->character)) - free(GET_HOST(d->character)); - GET_HOST(d->character) = strdup(d->host); - return 0; - } + GET_PREF(target) = pref_temp; + add_llog_entry(target, LAST_RECONNECT); - if (GET_HOST(target)) free(GET_HOST(target)); - GET_HOST(target) = strdup(d->host); + /* Okay, we've found a target. Connect d to target. */ + free_char(d->character); /* get rid of the old char */ + d->character = target; + d->character->desc = d; + d->original = NULL; + d->character->char_specials.timer = 0; + REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_MAILING); + REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING); + STATE(d) = CON_PLAYING; + MXPSendTag( d, "" ); - GET_PREF(target) = pref_temp; - add_llog_entry(target, LAST_RECONNECT); + switch (mode) { + case RECON: + write_to_output(d, "Reconnecting.\r\n"); + act("$n has reconnected.", TRUE, d->character, 0, 0, TO_ROOM); + mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character), + d->host); + if (has_mail(GET_IDNUM(d->character))) + write_to_output(d, "You have mail waiting.\r\n"); + break; + case USURP: + write_to_output(d, "You take over your own body, already in use!\r\n"); + act("$n suddenly keels over in pain, surrounded by a white aura...\r\n" + "$n's body has been taken over by a new spirit!", + TRUE, d->character, 0, 0, TO_ROOM); + mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, + "%s has re-logged in ... disconnecting old socket.", GET_NAME(d->character)); + break; + case UNSWITCH: + write_to_output(d, "Reconnecting to unswitched char."); + mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character), + d->host); + break; + } - /* Okay, we've found a target. Connect d to target. */ - free_char(d->character); /* get rid of the old char */ - d->character = target; - d->character->desc = d; - d->original = NULL; - d->character->char_specials.timer = 0; - REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_MAILING); - REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING); - STATE(d) = CON_PLAYING; - MXPSendTag( d, "" ); - - switch (mode) { - case RECON: - write_to_output(d, "Reconnecting.\r\n"); - act("$n has reconnected.", TRUE, d->character, 0, 0, TO_ROOM); - mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character), d->host); - if (has_mail(GET_IDNUM(d->character))) - write_to_output(d, "You have mail waiting.\r\n"); - break; - case USURP: - write_to_output(d, "You take over your own body, already in use!\r\n"); - act("$n suddenly keels over in pain, surrounded by a white aura...\r\n" - "$n's body has been taken over by a new spirit!", - TRUE, d->character, 0, 0, TO_ROOM); - mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, - "%s has re-logged in ... disconnecting old socket.", GET_NAME(d->character)); - break; - case UNSWITCH: - write_to_output(d, "Reconnecting to unswitched char."); - mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character), d->host); - break; - } - - return (1); + return (1); } /* New Char dupe-check called at the start of character creation */ static bool perform_new_char_dupe_check(struct descriptor_data *d) { - struct descriptor_data *k, *next_k; - bool found = FALSE; + struct descriptor_data *k, *next_k; + bool found = FALSE; - /* Now that this descriptor has successfully logged in, disconnect all - * other descriptors controlling a character with the same ID number. */ + /* Now that this descriptor has successfully logged in, disconnect all + * other descriptors controlling a character with the same ID number. */ - for (k = descriptor_list; k; k = next_k) { - next_k = k->next; + for (k = descriptor_list; k; k = next_k) { + next_k = k->next; - if (k == d) - continue; + if (k == d) + continue; - if (k->character == NULL) - continue; + if (k->character == NULL) + continue; - /* Do the player names match? */ - if (!strcmp(GET_NAME(k->character), GET_NAME(d->character))) { - /* Check the other character is still in creation? */ - if ((STATE(k) > CON_PLAYING) && (STATE(k) < CON_QCLASS)) { - /* Boot the older one */ - k->character->desc = NULL; - k->character = NULL; - k->original = NULL; - write_to_output(k, "\r\nMultiple login detected -- disconnecting.\r\n"); - STATE(k) = CON_CLOSE; + /* Do the player names match? */ + if (!strcmp(GET_NAME(k->character), GET_NAME(d->character))) { + /* Check the other character is still in creation? */ + if ((STATE(k) > CON_PLAYING) && (STATE(k) < CON_QCLASS)) { + /* Boot the older one */ + k->character->desc = NULL; + k->character = NULL; + k->original = NULL; + write_to_output(k, "\r\nMultiple login detected -- disconnecting.\r\n"); + STATE(k) = CON_CLOSE; - mudlog(NRM, LVL_GOD, TRUE, "Multiple logins detected in char creation for %s.", GET_NAME(d->character)); + mudlog(NRM, LVL_GOD, TRUE, "Multiple logins detected in char creation for %s.", GET_NAME(d->character)); - found = TRUE; - } else { - /* Something went VERY wrong, boot both chars */ - k->character->desc = NULL; - k->character = NULL; - k->original = NULL; - write_to_output(k, "\r\nMultiple login detected -- disconnecting.\r\n"); - STATE(k) = CON_CLOSE; + found = TRUE; + } else { + /* Something went VERY wrong, boot both chars */ + k->character->desc = NULL; + k->character = NULL; + k->original = NULL; + write_to_output(k, "\r\nMultiple login detected -- disconnecting.\r\n"); + STATE(k) = CON_CLOSE; - d->character->desc = NULL; - d->character = NULL; - d->original = NULL; - write_to_output(d, "\r\nSorry, due to multiple connections, all your connections are being closed.\r\n"); - write_to_output(d, "\r\nPlease reconnect.\r\n"); - STATE(d) = CON_CLOSE; + d->character->desc = NULL; + d->character = NULL; + d->original = NULL; + write_to_output(d, "\r\nSorry, due to multiple connections, all your connections are being closed.\r\n"); + write_to_output(d, "\r\nPlease reconnect.\r\n"); + STATE(d) = CON_CLOSE; - mudlog(NRM, LVL_GOD, TRUE, "SYSERR: Multiple logins with 1st in-game and the 2nd in char creation."); + mudlog(NRM, LVL_GOD, TRUE, "SYSERR: Multiple logins with 1st in-game and the 2nd in char creation."); - found = TRUE; - } + found = TRUE; + } + } } - } - return (found); + return (found); } /* load the player, put them in the right room - used by copyover_recover too */ int enter_player_game (struct descriptor_data *d) { - int load_result; - room_vnum load_room; + int load_result; + room_vnum load_room; - reset_char(d->character); + reset_char(d->character); - if (PLR_FLAGGED(d->character, PLR_INVSTART)) - GET_INVIS_LEV(d->character) = GET_LEVEL(d->character); + if (PLR_FLAGGED(d->character, PLR_INVSTART)) + GET_INVIS_LEV(d->character) = GET_LEVEL(d->character); - /* We have to place the character in a room before equipping them - * or equip_char() will gripe about the person in NOWHERE. */ - if ((load_room = GET_LOADROOM(d->character)) != NOWHERE) - load_room = real_room(load_room); + /* We have to place the character in a room before equipping them + * or equip_char() will gripe about the person in NOWHERE. */ + if ((load_room = GET_LOADROOM(d->character)) != NOWHERE) + load_room = real_room(load_room); - /* If char was saved with NOWHERE, or real_room above failed... */ - if (load_room == NOWHERE) { - if (GET_LEVEL(d->character) >= LVL_IMMORT) - load_room = r_immort_start_room; - else - load_room = r_mortal_start_room; - } + /* If char was saved with NOWHERE, or real_room above failed... */ + if (load_room == NOWHERE) { + if (GET_LEVEL(d->character) >= LVL_IMMORT) + load_room = r_immort_start_room; + else + load_room = r_mortal_start_room; + } - if (PLR_FLAGGED(d->character, PLR_FROZEN)) - load_room = r_frozen_start_room; + if (PLR_FLAGGED(d->character, PLR_FROZEN)) + load_room = r_frozen_start_room; - /* copyover */ - d->character->script_id = GET_IDNUM(d->character); - /* find_char helper */ - add_to_lookup_table(d->character->script_id, (void *)d->character); + /* copyover */ + d->character->script_id = GET_IDNUM(d->character); + /* find_char helper */ + add_to_lookup_table(d->character->script_id, (void *)d->character); - /* After moving saving of variables to the player file, this should only - * be called in case nothing was found in the pfile. If something was - * found, SCRIPT(ch) will be set. */ - if (!SCRIPT(d->character)) - read_saved_vars(d->character); + /* After moving saving of variables to the player file, this should only + * be called in case nothing was found in the pfile. If something was + * found, SCRIPT(ch) will be set. */ + if (!SCRIPT(d->character)) + read_saved_vars(d->character); - d->character->next = character_list; - character_list = d->character; - char_to_room(d->character, load_room); - load_result = Crash_load(d->character); - - /* Save the character and their object file */ - save_char(d->character); - Crash_crashsave(d->character); + d->character->next = character_list; + character_list = d->character; + char_to_room(d->character, load_room); + load_result = Crash_load(d->character); - /* Check for a login trigger in the players' start room */ - login_wtrigger(&world[IN_ROOM(d->character)], d->character); + /* Save the character and their object file */ + save_char(d->character); + Crash_crashsave(d->character); - return load_result; + /* Check for a login trigger in the players' start room */ + login_wtrigger(&world[IN_ROOM(d->character)], d->character); + + return load_result; } EVENTFUNC(get_protocols) { - struct descriptor_data *d; - struct mud_event_data *pMudEvent; - char buf[MAX_STRING_LENGTH]; - size_t len; + struct descriptor_data *d; + struct mud_event_data *pMudEvent; + char buf[MAX_STRING_LENGTH]; + size_t len; - if (event_obj == NULL) + if (event_obj == NULL) + return 0; + + pMudEvent = (struct mud_event_data *) event_obj; + d = (struct descriptor_data *) pMudEvent->pStruct; + + /* Clear extra white space from the "protocol scroll" */ + write_to_output(d, ""); + + len = snprintf(buf, MAX_STRING_LENGTH, "\tO[\toClient\tO] \tw%s\tn | ", + d->pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString); + + if (d->pProtocol->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt) + len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toColors\tO] \tw256\tn | "); + else if (d->pProtocol->pVariables[eMSDP_ANSI_COLORS]->ValueInt) + len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toColors\tO] \twAnsi\tn | "); + else + len += snprintf(buf + len, MAX_STRING_LENGTH - len, "[Colors] No Color | "); + + len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMXP\tO] \tw%s\tn | ", d->pProtocol->bMXP ? "Yes" : "No"); + len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMSDP\tO] \tw%s\tn | ", + d->pProtocol->bMSDP ? "Yes" : "No"); + snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toATCP\tO] \tw%s\tn\r\n\r\n", d->pProtocol->bATCP ? "Yes" : "No"); + + write_to_output(d, buf, 0); + + write_to_output(d, GREETINGS, 0); + STATE(d) = CON_GET_NAME; return 0; - - pMudEvent = (struct mud_event_data *) event_obj; - d = (struct descriptor_data *) pMudEvent->pStruct; - - /* Clear extra white space from the "protocol scroll" */ - write_to_output(d, ""); - - len = snprintf(buf, MAX_STRING_LENGTH, "\tO[\toClient\tO] \tw%s\tn | ", d->pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString); - - if (d->pProtocol->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt) - len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toColors\tO] \tw256\tn | "); - else if (d->pProtocol->pVariables[eMSDP_ANSI_COLORS]->ValueInt) - len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toColors\tO] \twAnsi\tn | "); - else - len += snprintf(buf + len, MAX_STRING_LENGTH - len, "[Colors] No Color | "); - - len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMXP\tO] \tw%s\tn | ", d->pProtocol->bMXP ? "Yes" : "No"); - len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMSDP\tO] \tw%s\tn | ", d->pProtocol->bMSDP ? "Yes" : "No"); - snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toATCP\tO] \tw%s\tn\r\n\r\n", d->pProtocol->bATCP ? "Yes" : "No"); - - write_to_output(d, buf, 0); - - write_to_output(d, GREETINGS, 0); - STATE(d) = CON_GET_NAME; - return 0; } /* deal with newcomers and other non-playing sockets */ void nanny(struct descriptor_data *d, char *arg) { - int load_result; /* Overloaded variable */ - int player_i; + int load_result; /* Overloaded variable */ + int player_i; - /* OasisOLC states */ - struct { - int state; - void (*func)(struct descriptor_data *, char *); - } olc_functions[] = { - { CON_OEDIT, oedit_parse }, - { CON_ZEDIT, zedit_parse }, - { CON_SEDIT, sedit_parse }, - { CON_MEDIT, medit_parse }, - { CON_REDIT, redit_parse }, - { CON_CEDIT, cedit_parse }, - { CON_TRIGEDIT, trigedit_parse }, - { CON_AEDIT, aedit_parse }, - { CON_HEDIT, hedit_parse }, - { CON_QEDIT, qedit_parse }, - { CON_PREFEDIT, prefedit_parse }, - { CON_IBTEDIT, ibtedit_parse }, - { CON_MSGEDIT, msgedit_parse }, - { -1, NULL } - }; + /* OasisOLC states */ + struct { + int state; + void (*func)(struct descriptor_data *, char *); + } olc_functions[] = { + { CON_OEDIT, oedit_parse }, + { CON_ZEDIT, zedit_parse }, + { CON_SEDIT, sedit_parse }, + { CON_MEDIT, medit_parse }, + { CON_REDIT, redit_parse }, + { CON_CEDIT, cedit_parse }, + { CON_TRIGEDIT, trigedit_parse }, + { CON_AEDIT, aedit_parse }, + { CON_HEDIT, hedit_parse }, + { CON_QEDIT, qedit_parse }, + { CON_PREFEDIT, prefedit_parse }, + { CON_IBTEDIT, ibtedit_parse }, + { CON_MSGEDIT, msgedit_parse }, + { -1, NULL } + }; - skip_spaces(&arg); + skip_spaces(&arg); - /* Quick check for the OLC states. */ - for (player_i = 0; olc_functions[player_i].state >= 0; player_i++) - if (STATE(d) == olc_functions[player_i].state) { - (*olc_functions[player_i].func)(d, arg); - return; - } - - /* Not in OLC. */ - switch (STATE(d)) { - case CON_GET_PROTOCOL: - write_to_output(d, "Collecting Protocol Information... Please Wait.\r\n"); - return; - case CON_GET_NAME: /* wait for input of name */ - if (d->character == NULL) { - CREATE(d->character, struct char_data, 1); - clear_char(d->character); - CREATE(d->character->player_specials, struct player_special_data, 1); - - new_mobile_data(d->character); - - GET_HOST(d->character) = strdup(d->host); - d->character->desc = d; - } - if (!*arg) - STATE(d) = CON_CLOSE; - else { - char buf[MAX_INPUT_LENGTH], tmp_name[MAX_INPUT_LENGTH]; - - if ((_parse_name(arg, tmp_name)) || strlen(tmp_name) < 2 || - strlen(tmp_name) > MAX_NAME_LENGTH || !valid_name(tmp_name) || - fill_word(strcpy(buf, tmp_name)) || reserved_word(buf)) { /* strcpy: OK (mutual MAX_INPUT_LENGTH) */ - write_to_output(d, "Invalid name, please try another.\r\nName: "); - return; - } - if ((player_i = load_char(tmp_name, d->character)) > -1) { - GET_PFILEPOS(d->character) = player_i; - - if (PLR_FLAGGED(d->character, PLR_DELETED)) { - /* Make sure old files are removed so the new player doesn't get the - * deleted player's equipment. */ - if ((player_i = get_ptable_by_name(tmp_name)) >= 0) - remove_player(player_i); - - /* We get a false positive from the original deleted character. */ - free_char(d->character); - - /* Check for multiple creations. */ - if (!valid_name(tmp_name)) { - write_to_output(d, "Invalid name, please try another.\r\nName: "); + /* Quick check for the OLC states. */ + for (player_i = 0; olc_functions[player_i].state >= 0; player_i++) + if (STATE(d) == olc_functions[player_i].state) { + (*olc_functions[player_i].func)(d, arg); return; - } - CREATE(d->character, struct char_data, 1); - clear_char(d->character); - CREATE(d->character->player_specials, struct player_special_data, 1); + } - new_mobile_data(d->character); + /* Not in OLC. */ + switch (STATE(d)) { + case CON_GET_PROTOCOL: + write_to_output(d, "Collecting Protocol Information... Please Wait.\r\n"); + return; + case CON_GET_NAME: /* wait for input of name */ + if (d->character == NULL) { + CREATE(d->character, struct char_data, 1); + clear_char(d->character); + CREATE(d->character->player_specials, struct player_special_data, 1); - if (GET_HOST(d->character)) - free(GET_HOST(d->character)); - GET_HOST(d->character) = strdup(d->host); + new_mobile_data(d->character); - d->character->desc = d; - CREATE(d->character->player.name, char, strlen(tmp_name) + 1); - strcpy(d->character->player.name, CAP(tmp_name)); /* strcpy: OK (size checked above) */ - GET_PFILEPOS(d->character) = player_i; - write_to_output(d, "Did I get that right, %s (\t(Y\t)/\t(N\t))? ", tmp_name); - STATE(d) = CON_NAME_CNFRM; + GET_HOST(d->character) = strdup(d->host); + d->character->desc = d; + } + if (!*arg) + STATE(d) = CON_CLOSE; + else { + char buf[MAX_INPUT_LENGTH], tmp_name[MAX_INPUT_LENGTH]; + + if ((_parse_name(arg, tmp_name)) || strlen(tmp_name) < 2 || + strlen(tmp_name) > MAX_NAME_LENGTH || !valid_name(tmp_name) || + fill_word(strcpy(buf, tmp_name)) || reserved_word(buf)) { /* strcpy: OK (mutual MAX_INPUT_LENGTH) */ + write_to_output(d, "Invalid name, please try another.\r\nName: "); + return; + } + if ((player_i = load_char(tmp_name, d->character)) > -1) { + GET_PFILEPOS(d->character) = player_i; + + if (PLR_FLAGGED(d->character, PLR_DELETED)) { + /* Make sure old files are removed so the new player doesn't get the + * deleted player's equipment. */ + if ((player_i = get_ptable_by_name(tmp_name)) >= 0) + remove_player(player_i); + + /* We get a false positive from the original deleted character. */ + free_char(d->character); + + /* Check for multiple creations. */ + if (!valid_name(tmp_name)) { + write_to_output(d, "Invalid name, please try another.\r\nName: "); + return; + } + CREATE(d->character, struct char_data, 1); + clear_char(d->character); + CREATE(d->character->player_specials, struct player_special_data, 1); + + new_mobile_data(d->character); + + if (GET_HOST(d->character)) + free(GET_HOST(d->character)); + GET_HOST(d->character) = strdup(d->host); + + d->character->desc = d; + CREATE(d->character->player.name, char, strlen(tmp_name) + 1); + strcpy(d->character->player.name, CAP(tmp_name)); /* strcpy: OK (size checked above) */ + GET_PFILEPOS(d->character) = player_i; + write_to_output(d, "Did I get that right, %s (\t(Y\t)/\t(N\t))? ", tmp_name); + STATE(d) = CON_NAME_CNFRM; + } else { + /* undo it just in case they are set */ + REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING); + REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_MAILING); + REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_CRYO); + d->character->player.time.logon = time(0); + write_to_output(d, "Password: "); + echo_off(d); + d->idle_tics = 0; + STATE(d) = CON_PASSWORD; + } + } else { + /* player unknown -- make new character */ + + /* Check for multiple creations of a character. */ + if (!valid_name(tmp_name)) { + write_to_output(d, "Invalid name, please try another.\r\nName: "); + return; + } + CREATE(d->character->player.name, char, strlen(tmp_name) + 1); + strcpy(d->character->player.name, CAP(tmp_name)); /* strcpy: OK (size checked above) */ + + write_to_output(d, "Did I get that right, %s (\t(Y\t)/\t(N\t))? ", tmp_name); + STATE(d) = CON_NAME_CNFRM; + } + } + break; + + case CON_NAME_CNFRM: /* wait for conf. of new name */ + if (UPPER(*arg) == 'Y') { + if (isbanned(d->host) >= BAN_NEW) { + mudlog(NRM, LVL_GOD, TRUE, "Request for new char %s denied from [%s] (siteban)", GET_PC_NAME(d->character), d->host); + write_to_output(d, "Sorry, new characters are not allowed from your site!\r\n"); + STATE(d) = CON_CLOSE; + return; + } + if (circle_restrict) { + write_to_output(d, "Sorry, new players can't be created at the moment.\r\n"); + mudlog(NRM, LVL_GOD, TRUE, "Request for new char %s denied from [%s] (wizlock)", GET_PC_NAME(d->character), d->host); + STATE(d) = CON_CLOSE; + return; + } + perform_new_char_dupe_check(d); + write_to_output(d, "New character.\r\nGive me a password for %s: ", GET_PC_NAME(d->character)); + echo_off(d); + STATE(d) = CON_NEWPASSWD; + } else if (*arg == 'n' || *arg == 'N') { + write_to_output(d, "Okay, what IS it, then? "); + free(d->character->player.name); + d->character->player.name = NULL; + STATE(d) = CON_GET_NAME; + } else + write_to_output(d, "Please type Yes or No: "); + break; + + case CON_PASSWORD: /* get pwd for known player */ + /* To really prevent duping correctly, the player's record should be reloaded + * from disk at this point (after the password has been typed). However I'm + * afraid that trying to load a character over an already loaded character is + * going to cause some problem down the road that I can't see at the moment. + * So to compensate, I'm going to (1) add a 15 or 20-second time limit for + * entering a password, and (2) re-add the code to cut off duplicates when a + * player quits. JE 6 Feb 96 */ + + echo_on(d); /* turn echo back on */ + + /* New echo_on() eats the return on telnet. Extra space better than none. */ + write_to_output(d, "\r\n"); + + if (!*arg) + STATE(d) = CON_CLOSE; + else { + if (strncmp(CRYPT(arg, GET_PASSWD(d->character)), GET_PASSWD(d->character), MAX_PWD_LENGTH)) { + mudlog(BRF, LVL_GOD, TRUE, "Bad PW: %s [%s]", GET_NAME(d->character), d->host); + GET_BAD_PWS(d->character)++; + save_char(d->character); + if (++(d->bad_pws) >= CONFIG_MAX_BAD_PWS) { /* 3 strikes and you're out. */ + write_to_output(d, "Wrong password... disconnecting.\r\n"); + STATE(d) = CON_CLOSE; + } else { + write_to_output(d, "Wrong password.\r\nPassword: "); + echo_off(d); + } + return; + } + + /* Password was correct. */ + load_result = GET_BAD_PWS(d->character); + GET_BAD_PWS(d->character) = 0; + d->bad_pws = 0; + + if (isbanned(d->host) == BAN_SELECT && + !PLR_FLAGGED(d->character, PLR_SITEOK)) { + write_to_output(d, "Sorry, this char has not been cleared for login from your site!\r\n"); + STATE(d) = CON_CLOSE; + mudlog(NRM, LVL_GOD, TRUE, "Connection attempt for %s denied from %s", GET_NAME(d->character), d->host); + return; + } + if (GET_LEVEL(d->character) < circle_restrict) { + write_to_output(d, "The game is temporarily restricted.. try again later.\r\n"); + STATE(d) = CON_CLOSE; + mudlog(NRM, LVL_GOD, TRUE, "Request for login denied for %s [%s] (wizlock)", GET_NAME(d->character), d->host); + return; + } + /* check and make sure no other copies of this player are logged in */ + if (perform_dupe_check(d)) + return; + + if (GET_LEVEL(d->character) >= LVL_IMMORT) + write_to_output(d, "%s", imotd); + else + write_to_output(d, "%s", motd); + + if (GET_INVIS_LEV(d->character)) + mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s has connected. (invis %d)", GET_NAME(d->character), + GET_INVIS_LEV(d->character)); + else + mudlog(BRF, LVL_IMMORT, TRUE, "%s has connected.", GET_NAME(d->character)); + + /* Add to the list of 'recent' players (since last reboot) */ + if (AddRecentPlayer(GET_NAME(d->character), d->host, FALSE, FALSE) == FALSE) { + mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE)."); + } + + if (load_result) { + write_to_output(d, "\r\n\r\n\007\007\007" + "%s%d LOGIN FAILURE%s SINCE LAST SUCCESSFUL LOGIN.%s\r\n", + CCRED(d->character, C_SPR), load_result, + (load_result > 1) ? "S" : "", CCNRM(d->character, C_SPR)); + GET_BAD_PWS(d->character) = 0; + } + write_to_output(d, "\r\n*** PRESS RETURN: "); + STATE(d) = CON_RMOTD; + } + break; + + case CON_NEWPASSWD: + case CON_CHPWD_GETNEW: + if (!*arg || strlen(arg) > MAX_PWD_LENGTH || strlen(arg) < 3 || + !str_cmp(arg, GET_PC_NAME(d->character))) { + write_to_output(d, "\r\nIllegal password.\r\nPassword: "); + return; + } + strncpy(GET_PASSWD(d->character), CRYPT(arg, GET_PC_NAME(d->character)), + MAX_PWD_LENGTH); /* strncpy: OK (G_P:MAX_PWD_LENGTH+1) */ + *(GET_PASSWD(d->character) + MAX_PWD_LENGTH) = '\0'; + + write_to_output(d, "\r\nPlease retype password: "); + if (STATE(d) == CON_NEWPASSWD) + STATE(d) = CON_CNFPASSWD; + else + STATE(d) = CON_CHPWD_VRFY; + break; + + case CON_CNFPASSWD: + case CON_CHPWD_VRFY: + if (strncmp(CRYPT(arg, GET_PASSWD(d->character)), GET_PASSWD(d->character), + MAX_PWD_LENGTH)) { + write_to_output(d, "\r\nPasswords don't match... start over.\r\nPassword: "); + if (STATE(d) == CON_CNFPASSWD) + STATE(d) = CON_NEWPASSWD; + else + STATE(d) = CON_CHPWD_GETNEW; + return; + } + echo_on(d); + + if (STATE(d) == CON_CNFPASSWD) { + write_to_output(d, "\r\nWhat is your sex (\t(M\t)/\t(F\t))? "); + STATE(d) = CON_QSEX; } else { - /* undo it just in case they are set */ - REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING); - REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_MAILING); - REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_CRYO); - d->character->player.time.logon = time(0); - write_to_output(d, "Password: "); - echo_off(d); - d->idle_tics = 0; - STATE(d) = CON_PASSWORD; + save_char(d->character); + write_to_output(d, "\r\nDone.\r\n%s", CONFIG_MENU); + STATE(d) = CON_MENU; } - } else { - /* player unknown -- make new character */ + break; - /* Check for multiple creations of a character. */ - if (!valid_name(tmp_name)) { - write_to_output(d, "Invalid name, please try another.\r\nName: "); - return; + case CON_QSEX: /* query sex of new user */ + switch (*arg) { + case 'm': + case 'M': + d->character->player.sex = SEX_MALE; + break; + case 'f': + case 'F': + d->character->player.sex = SEX_FEMALE; + break; + default: + write_to_output(d, "That is not a sex..\r\n" + "What IS your sex? "); + return; } - CREATE(d->character->player.name, char, strlen(tmp_name) + 1); - strcpy(d->character->player.name, CAP(tmp_name)); /* strcpy: OK (size checked above) */ - write_to_output(d, "Did I get that right, %s (\t(Y\t)/\t(N\t))? ", tmp_name); - STATE(d) = CON_NAME_CNFRM; - } - } - break; + write_to_output(d, "%s\r\nClass: ", class_menu); + STATE(d) = CON_QCLASS; + break; - case CON_NAME_CNFRM: /* wait for conf. of new name */ - if (UPPER(*arg) == 'Y') { - if (isbanned(d->host) >= BAN_NEW) { - mudlog(NRM, LVL_GOD, TRUE, "Request for new char %s denied from [%s] (siteban)", GET_PC_NAME(d->character), d->host); - write_to_output(d, "Sorry, new characters are not allowed from your site!\r\n"); - STATE(d) = CON_CLOSE; - return; - } - if (circle_restrict) { - write_to_output(d, "Sorry, new players can't be created at the moment.\r\n"); - mudlog(NRM, LVL_GOD, TRUE, "Request for new char %s denied from [%s] (wizlock)", GET_PC_NAME(d->character), d->host); - STATE(d) = CON_CLOSE; - return; - } - perform_new_char_dupe_check(d); - write_to_output(d, "New character.\r\nGive me a password for %s: ", GET_PC_NAME(d->character)); - echo_off(d); - STATE(d) = CON_NEWPASSWD; - } else if (*arg == 'n' || *arg == 'N') { - write_to_output(d, "Okay, what IS it, then? "); - free(d->character->player.name); - d->character->player.name = NULL; - STATE(d) = CON_GET_NAME; - } else - write_to_output(d, "Please type Yes or No: "); - break; + case CON_QCLASS: + load_result = parse_class(*arg); + if (load_result == CLASS_UNDEFINED) { + write_to_output(d, "\r\nThat's not a class.\r\nClass: "); + return; + } else + GET_CLASS(d->character) = load_result; - case CON_PASSWORD: /* get pwd for known player */ - /* To really prevent duping correctly, the player's record should be reloaded - * from disk at this point (after the password has been typed). However I'm - * afraid that trying to load a character over an already loaded character is - * going to cause some problem down the road that I can't see at the moment. - * So to compensate, I'm going to (1) add a 15 or 20-second time limit for - * entering a password, and (2) re-add the code to cut off duplicates when a - * player quits. JE 6 Feb 96 */ + if (d->olc) { + free(d->olc); + d->olc = NULL; + } + if (GET_PFILEPOS(d->character) < 0) + GET_PFILEPOS(d->character) = create_entry(GET_PC_NAME(d->character)); + /* Now GET_NAME() will work properly. */ + init_char(d->character); + save_char(d->character); + save_player_index(); + write_to_output(d, "%s\r\n*** PRESS RETURN: ", motd); + STATE(d) = CON_RMOTD; + /* make sure the last log is updated correctly. */ + GET_PREF(d->character)= rand_number(1, 128000); + GET_HOST(d->character)= strdup(d->host); - echo_on(d); /* turn echo back on */ + mudlog(NRM, LVL_GOD, TRUE, "%s [%s] new player.", GET_NAME(d->character), d->host); - /* New echo_on() eats the return on telnet. Extra space better than none. */ - write_to_output(d, "\r\n"); + /* Add to the list of 'recent' players (since last reboot) */ + if (AddRecentPlayer(GET_NAME(d->character), d->host, TRUE, FALSE) == FALSE) { + mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE)."); + } + break; - if (!*arg) - STATE(d) = CON_CLOSE; - else { - if (strncmp(CRYPT(arg, GET_PASSWD(d->character)), GET_PASSWD(d->character), MAX_PWD_LENGTH)) { - mudlog(BRF, LVL_GOD, TRUE, "Bad PW: %s [%s]", GET_NAME(d->character), d->host); - GET_BAD_PWS(d->character)++; - save_char(d->character); - if (++(d->bad_pws) >= CONFIG_MAX_BAD_PWS) { /* 3 strikes and you're out. */ - write_to_output(d, "Wrong password... disconnecting.\r\n"); - STATE(d) = CON_CLOSE; - } else { - write_to_output(d, "Wrong password.\r\nPassword: "); - echo_off(d); - } - return; - } + case CON_RMOTD: /* read CR after printing motd */ + write_to_output(d, "%s", CONFIG_MENU); + if (IS_HAPPYHOUR > 0) { + write_to_output(d, "\r\n"); + write_to_output(d, "\tyThere is currently a Happyhour!\tn\r\n"); + write_to_output(d, "\r\n"); + } + add_llog_entry(d->character, LAST_CONNECT); + STATE(d) = CON_MENU; + break; - /* Password was correct. */ - load_result = GET_BAD_PWS(d->character); - GET_BAD_PWS(d->character) = 0; - d->bad_pws = 0; + case CON_MENU: { /* get selection from main menu */ - if (isbanned(d->host) == BAN_SELECT && - !PLR_FLAGGED(d->character, PLR_SITEOK)) { - write_to_output(d, "Sorry, this char has not been cleared for login from your site!\r\n"); - STATE(d) = CON_CLOSE; - mudlog(NRM, LVL_GOD, TRUE, "Connection attempt for %s denied from %s", GET_NAME(d->character), d->host); - return; - } - if (GET_LEVEL(d->character) < circle_restrict) { - write_to_output(d, "The game is temporarily restricted.. try again later.\r\n"); - STATE(d) = CON_CLOSE; - mudlog(NRM, LVL_GOD, TRUE, "Request for login denied for %s [%s] (wizlock)", GET_NAME(d->character), d->host); - return; - } - /* check and make sure no other copies of this player are logged in */ - if (perform_dupe_check(d)) - return; + switch (*arg) { + case '0': + write_to_output(d, "Goodbye.\r\n"); + add_llog_entry(d->character, LAST_QUIT); + STATE(d) = CON_CLOSE; + break; - if (GET_LEVEL(d->character) >= LVL_IMMORT) - write_to_output(d, "%s", imotd); - else - write_to_output(d, "%s", motd); + case '1': + load_result = enter_player_game(d); + send_to_char(d->character, "%s", CONFIG_WELC_MESSG); - if (GET_INVIS_LEV(d->character)) - mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s has connected. (invis %d)", GET_NAME(d->character), GET_INVIS_LEV(d->character)); - else - mudlog(BRF, LVL_IMMORT, TRUE, "%s has connected.", GET_NAME(d->character)); + /* Clear their load room if it's not persistant. */ + if (!PLR_FLAGGED(d->character, PLR_LOADROOM)) + GET_LOADROOM(d->character) = NOWHERE; + save_char(d->character); - /* Add to the list of 'recent' players (since last reboot) */ - if (AddRecentPlayer(GET_NAME(d->character), d->host, FALSE, FALSE) == FALSE) - { - mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE)."); - } + greet_mtrigger(d->character, -1); + greet_memory_mtrigger(d->character); - if (load_result) { - write_to_output(d, "\r\n\r\n\007\007\007" - "%s%d LOGIN FAILURE%s SINCE LAST SUCCESSFUL LOGIN.%s\r\n", - CCRED(d->character, C_SPR), load_result, - (load_result > 1) ? "S" : "", CCNRM(d->character, C_SPR)); - GET_BAD_PWS(d->character) = 0; - } - write_to_output(d, "\r\n*** PRESS RETURN: "); - STATE(d) = CON_RMOTD; - } - break; + act("$n has entered the game.", TRUE, d->character, 0, 0, TO_ROOM); - case CON_NEWPASSWD: - case CON_CHPWD_GETNEW: - if (!*arg || strlen(arg) > MAX_PWD_LENGTH || strlen(arg) < 3 || - !str_cmp(arg, GET_PC_NAME(d->character))) { - write_to_output(d, "\r\nIllegal password.\r\nPassword: "); - return; - } - strncpy(GET_PASSWD(d->character), CRYPT(arg, GET_PC_NAME(d->character)), MAX_PWD_LENGTH); /* strncpy: OK (G_P:MAX_PWD_LENGTH+1) */ - *(GET_PASSWD(d->character) + MAX_PWD_LENGTH) = '\0'; + STATE(d) = CON_PLAYING; + MXPSendTag( d, "" ); + if (GET_LEVEL(d->character) == 0) { + do_start(d->character); + send_to_char(d->character, "%s", CONFIG_START_MESSG); + } + look_at_room(d->character, 0); + if (has_mail(GET_IDNUM(d->character))) + send_to_char(d->character, "You have mail waiting.\r\n"); + if (load_result == 2) { /* rented items lost */ + send_to_char(d->character, "\r\n\007You could not afford your rent!\r\n" + "Your possesions have been donated to the Salvation Army!\r\n"); + } + d->has_prompt = 0; + /* We've updated to 3.1 - some bits might be set wrongly: */ + REMOVE_BIT_AR(PRF_FLAGS(d->character), PRF_BUILDWALK); + break; - write_to_output(d, "\r\nPlease retype password: "); - if (STATE(d) == CON_NEWPASSWD) - STATE(d) = CON_CNFPASSWD; - else - STATE(d) = CON_CHPWD_VRFY; - break; + case '2': + if (d->character->player.description) { + write_to_output(d, "Current description:\r\n%s", d->character->player.description); + /* Don't free this now... so that the old description gets loaded as the + * current buffer in the editor. Do setup the ABORT buffer here, however. */ + d->backstr = strdup(d->character->player.description); + } + write_to_output(d, "Enter the new text you'd like others to see when they look at you.\r\n"); + send_editor_help(d); + d->str = &d->character->player.description; + d->max_str = PLR_DESC_LENGTH; + STATE(d) = CON_PLR_DESC; + break; - case CON_CNFPASSWD: - case CON_CHPWD_VRFY: - if (strncmp(CRYPT(arg, GET_PASSWD(d->character)), GET_PASSWD(d->character), - MAX_PWD_LENGTH)) { - write_to_output(d, "\r\nPasswords don't match... start over.\r\nPassword: "); - if (STATE(d) == CON_CNFPASSWD) - STATE(d) = CON_NEWPASSWD; - else - STATE(d) = CON_CHPWD_GETNEW; - return; - } - echo_on(d); + case '3': + page_string(d, background, 0); + STATE(d) = CON_RMOTD; + break; - if (STATE(d) == CON_CNFPASSWD) { - write_to_output(d, "\r\nWhat is your sex (\t(M\t)/\t(F\t))? "); - STATE(d) = CON_QSEX; - } else { - save_char(d->character); - write_to_output(d, "\r\nDone.\r\n%s", CONFIG_MENU); - STATE(d) = CON_MENU; - } - break; + case '4': + write_to_output(d, "\r\nEnter your old password: "); + echo_off(d); + STATE(d) = CON_CHPWD_GETOLD; + break; - case CON_QSEX: /* query sex of new user */ - switch (*arg) { - case 'm': - case 'M': - d->character->player.sex = SEX_MALE; - break; - case 'f': - case 'F': - d->character->player.sex = SEX_FEMALE; - break; - default: - write_to_output(d, "That is not a sex..\r\n" - "What IS your sex? "); - return; + case '5': + write_to_output(d, "\r\nEnter your password for verification: "); + echo_off(d); + STATE(d) = CON_DELCNF1; + break; + + default: + write_to_output(d, "\r\nThat's not a menu choice!\r\n%s", CONFIG_MENU); + break; + } + break; } - write_to_output(d, "%s\r\nClass: ", class_menu); - STATE(d) = CON_QCLASS; - break; + case CON_CHPWD_GETOLD: + if (strncmp(CRYPT(arg, GET_PASSWD(d->character)), GET_PASSWD(d->character), MAX_PWD_LENGTH)) { + echo_on(d); + write_to_output(d, "\r\nIncorrect password.\r\n%s", CONFIG_MENU); + STATE(d) = CON_MENU; + } else { + write_to_output(d, "\r\nEnter a new password: "); + STATE(d) = CON_CHPWD_GETNEW; + } + return; - case CON_QCLASS: - load_result = parse_class(*arg); - if (load_result == CLASS_UNDEFINED) { - write_to_output(d, "\r\nThat's not a class.\r\nClass: "); - return; - } else - GET_CLASS(d->character) = load_result; + case CON_DELCNF1: + echo_on(d); + if (strncmp(CRYPT(arg, GET_PASSWD(d->character)), GET_PASSWD(d->character), MAX_PWD_LENGTH)) { + write_to_output(d, "\r\nIncorrect password.\r\n%s", CONFIG_MENU); + STATE(d) = CON_MENU; + } else { + write_to_output(d, "\r\nYOU ARE ABOUT TO DELETE THIS CHARACTER PERMANENTLY.\r\n" + "ARE YOU ABSOLUTELY SURE?\r\n\r\n" + "Please type \"yes\" to confirm: "); + STATE(d) = CON_DELCNF2; + } + break; - if (d->olc) { - free(d->olc); - d->olc = NULL; - } - if (GET_PFILEPOS(d->character) < 0) - GET_PFILEPOS(d->character) = create_entry(GET_PC_NAME(d->character)); - /* Now GET_NAME() will work properly. */ - init_char(d->character); - save_char(d->character); - save_player_index(); - write_to_output(d, "%s\r\n*** PRESS RETURN: ", motd); - STATE(d) = CON_RMOTD; - /* make sure the last log is updated correctly. */ - GET_PREF(d->character)= rand_number(1, 128000); - GET_HOST(d->character)= strdup(d->host); + case CON_DELCNF2: + if (!strcmp(arg, "yes") || !strcmp(arg, "YES")) { + if (PLR_FLAGGED(d->character, PLR_FROZEN)) { + write_to_output(d, "You try to kill yourself, but the ice stops you.\r\n" + "Character not deleted.\r\n\r\n"); + STATE(d) = CON_CLOSE; + return; + } + if (GET_LEVEL(d->character) < LVL_GRGOD) + SET_BIT_AR(PLR_FLAGS(d->character), PLR_DELETED); + save_char(d->character); + Crash_delete_file(GET_NAME(d->character)); + /* If the selfdelete_fastwipe flag is set (in config.c), remove all the + * player's immediately. */ + if (selfdelete_fastwipe) + if ((player_i = get_ptable_by_name(GET_NAME(d->character))) >= 0) { + SET_BIT(player_table[player_i].flags, PINDEX_SELFDELETE); + remove_player(player_i); + } - mudlog(NRM, LVL_GOD, TRUE, "%s [%s] new player.", GET_NAME(d->character), d->host); + delete_variables(GET_NAME(d->character)); + write_to_output(d, "Character '%s' deleted! Goodbye.\r\n", GET_NAME(d->character)); + mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE, "%s (lev %d) has self-deleted.", + GET_NAME(d->character), GET_LEVEL(d->character)); + STATE(d) = CON_CLOSE; + return; + } else { + write_to_output(d, "\r\nCharacter not deleted.\r\n%s", CONFIG_MENU); + STATE(d) = CON_MENU; + } + break; - /* Add to the list of 'recent' players (since last reboot) */ - if (AddRecentPlayer(GET_NAME(d->character), d->host, TRUE, FALSE) == FALSE) - { - mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE)."); - } - break; - - case CON_RMOTD: /* read CR after printing motd */ - write_to_output(d, "%s", CONFIG_MENU); - if (IS_HAPPYHOUR > 0){ - write_to_output(d, "\r\n"); - write_to_output(d, "\tyThere is currently a Happyhour!\tn\r\n"); - write_to_output(d, "\r\n"); - } - add_llog_entry(d->character, LAST_CONNECT); - STATE(d) = CON_MENU; - break; - - case CON_MENU: { /* get selection from main menu */ - - switch (*arg) { - case '0': - write_to_output(d, "Goodbye.\r\n"); - add_llog_entry(d->character, LAST_QUIT); - STATE(d) = CON_CLOSE; - break; - - case '1': - load_result = enter_player_game(d); - send_to_char(d->character, "%s", CONFIG_WELC_MESSG); - - /* Clear their load room if it's not persistant. */ - if (!PLR_FLAGGED(d->character, PLR_LOADROOM)) - GET_LOADROOM(d->character) = NOWHERE; - save_char(d->character); - - greet_mtrigger(d->character, -1); - greet_memory_mtrigger(d->character); - - act("$n has entered the game.", TRUE, d->character, 0, 0, TO_ROOM); - - STATE(d) = CON_PLAYING; - MXPSendTag( d, "" ); - if (GET_LEVEL(d->character) == 0) { - do_start(d->character); - send_to_char(d->character, "%s", CONFIG_START_MESSG); - } - look_at_room(d->character, 0); - if (has_mail(GET_IDNUM(d->character))) - send_to_char(d->character, "You have mail waiting.\r\n"); - if (load_result == 2) { /* rented items lost */ - send_to_char(d->character, "\r\n\007You could not afford your rent!\r\n" - "Your possesions have been donated to the Salvation Army!\r\n"); - } - d->has_prompt = 0; - /* We've updated to 3.1 - some bits might be set wrongly: */ - REMOVE_BIT_AR(PRF_FLAGS(d->character), PRF_BUILDWALK); - break; - - case '2': - if (d->character->player.description) { - write_to_output(d, "Current description:\r\n%s", d->character->player.description); - /* Don't free this now... so that the old description gets loaded as the - * current buffer in the editor. Do setup the ABORT buffer here, however. */ - d->backstr = strdup(d->character->player.description); - } - write_to_output(d, "Enter the new text you'd like others to see when they look at you.\r\n"); - send_editor_help(d); - d->str = &d->character->player.description; - d->max_str = PLR_DESC_LENGTH; - STATE(d) = CON_PLR_DESC; - break; - - case '3': - page_string(d, background, 0); - STATE(d) = CON_RMOTD; - break; - - case '4': - write_to_output(d, "\r\nEnter your old password: "); - echo_off(d); - STATE(d) = CON_CHPWD_GETOLD; - break; - - case '5': - write_to_output(d, "\r\nEnter your password for verification: "); - echo_off(d); - STATE(d) = CON_DELCNF1; - break; + /* It is possible, if enough pulses are missed, to kick someone off while they + * are at the password prompt. We'll let the game_loop()axe them. */ + case CON_CLOSE: + break; default: - write_to_output(d, "\r\nThat's not a menu choice!\r\n%s", CONFIG_MENU); - break; + log("SYSERR: Nanny: illegal state of con'ness (%d) for '%s'; closing connection.", + STATE(d), d->character ? GET_NAME(d->character) : ""); + STATE(d) = CON_DISCONNECT; /* Safest to do. */ + break; } - break; - } - - case CON_CHPWD_GETOLD: - if (strncmp(CRYPT(arg, GET_PASSWD(d->character)), GET_PASSWD(d->character), MAX_PWD_LENGTH)) { - echo_on(d); - write_to_output(d, "\r\nIncorrect password.\r\n%s", CONFIG_MENU); - STATE(d) = CON_MENU; - } else { - write_to_output(d, "\r\nEnter a new password: "); - STATE(d) = CON_CHPWD_GETNEW; - } - return; - - case CON_DELCNF1: - echo_on(d); - if (strncmp(CRYPT(arg, GET_PASSWD(d->character)), GET_PASSWD(d->character), MAX_PWD_LENGTH)) { - write_to_output(d, "\r\nIncorrect password.\r\n%s", CONFIG_MENU); - STATE(d) = CON_MENU; - } else { - write_to_output(d, "\r\nYOU ARE ABOUT TO DELETE THIS CHARACTER PERMANENTLY.\r\n" - "ARE YOU ABSOLUTELY SURE?\r\n\r\n" - "Please type \"yes\" to confirm: "); - STATE(d) = CON_DELCNF2; - } - break; - - case CON_DELCNF2: - if (!strcmp(arg, "yes") || !strcmp(arg, "YES")) { - if (PLR_FLAGGED(d->character, PLR_FROZEN)) { - write_to_output(d, "You try to kill yourself, but the ice stops you.\r\n" - "Character not deleted.\r\n\r\n"); - STATE(d) = CON_CLOSE; - return; - } - if (GET_LEVEL(d->character) < LVL_GRGOD) - SET_BIT_AR(PLR_FLAGS(d->character), PLR_DELETED); - save_char(d->character); - Crash_delete_file(GET_NAME(d->character)); - /* If the selfdelete_fastwipe flag is set (in config.c), remove all the - * player's immediately. */ - if (selfdelete_fastwipe) - if ((player_i = get_ptable_by_name(GET_NAME(d->character))) >= 0) { - SET_BIT(player_table[player_i].flags, PINDEX_SELFDELETE); - remove_player(player_i); - } - - delete_variables(GET_NAME(d->character)); - write_to_output(d, "Character '%s' deleted! Goodbye.\r\n", GET_NAME(d->character)); - mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE, "%s (lev %d) has self-deleted.", - GET_NAME(d->character), GET_LEVEL(d->character)); - STATE(d) = CON_CLOSE; - return; - } else { - write_to_output(d, "\r\nCharacter not deleted.\r\n%s", CONFIG_MENU); - STATE(d) = CON_MENU; - } - break; - - /* It is possible, if enough pulses are missed, to kick someone off while they - * are at the password prompt. We'll let the game_loop()axe them. */ - case CON_CLOSE: - break; - - default: - log("SYSERR: Nanny: illegal state of con'ness (%d) for '%s'; closing connection.", - STATE(d), d->character ? GET_NAME(d->character) : ""); - STATE(d) = CON_DISCONNECT; /* Safest to do. */ - break; - } } diff --git a/src/interpreter.h b/src/interpreter.h index 0ad8534..2b74aed 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -21,21 +21,21 @@ #define IS_MOVE(cmdnum) (complete_cmd_info[cmdnum].command_pointer == do_move) void sort_commands(void); -void command_interpreter(struct char_data *ch, char *argument); -int search_block(char *arg, const char **list, int exact); -char *one_argument(char *argument, char *first_arg); -char *one_word(char *argument, char *first_arg); -char *any_one_arg(char *argument, char *first_arg); -char *two_arguments(char *argument, char *first_arg, char *second_arg); -int fill_word(char *argument); +void command_interpreter(struct char_data *ch, char *argument); +int search_block(char *arg, const char **list, int exact); +char *one_argument(char *argument, char *first_arg); +char *one_word(char *argument, char *first_arg); +char *any_one_arg(char *argument, char *first_arg); +char *two_arguments(char *argument, char *first_arg, char *second_arg); +int fill_word(char *argument); int reserved_word(char *argument); -void half_chop(char *string, char *arg1, char *arg2); -void nanny(struct descriptor_data *d, char *arg); -int is_abbrev(const char *arg1, const char *arg2); -int is_number(const char *str); -int find_command(const char *command); -void skip_spaces(char **string); -char *delete_doubledollar(char *string); +void half_chop(char *string, char *arg1, char *arg2); +void nanny(struct descriptor_data *d, char *arg); +int is_abbrev(const char *arg1, const char *arg2); +int is_number(const char *str); +int find_command(const char *command); +void skip_spaces(char **string); +char *delete_doubledollar(char *string); int special(struct char_data *ch, int cmd, char *arg); void free_alias(struct alias_data *a); int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen); @@ -54,35 +54,35 @@ ACMD(do_alias); #define RESERVE_CMDS 7 struct command_info { - const char *command; - const char *sort_as; - byte minimum_position; - void (*command_pointer) - (struct char_data *ch, char *argument, int cmd, int subcmd); - sh_int minimum_level; - int subcmd; + const char *command; + const char *sort_as; + byte minimum_position; + void (*command_pointer) + (struct char_data *ch, char *argument, int cmd, int subcmd); + sh_int minimum_level; + int subcmd; }; struct mob_script_command_t { - const char *command_name; - void (*command_pointer) - (struct char_data *ch, char *argument, int cmd, int subcmd); - int subcmd; + const char *command_name; + void (*command_pointer) + (struct char_data *ch, char *argument, int cmd, int subcmd); + int subcmd; }; struct alias_data { - char *alias; - char *replacement; - int type; - struct alias_data *next; + char *alias; + char *replacement; + int type; + struct alias_data *next; }; -#define ALIAS_SIMPLE 0 -#define ALIAS_COMPLEX 1 +#define ALIAS_SIMPLE 0 +#define ALIAS_COMPLEX 1 -#define ALIAS_SEP_CHAR ';' -#define ALIAS_VAR_CHAR '$' -#define ALIAS_GLOB_CHAR '*' +#define ALIAS_SEP_CHAR ';' +#define ALIAS_VAR_CHAR '$' +#define ALIAS_GLOB_CHAR '*' /* SUBCOMMANDS: You can define these however you want to, and the definitions * of the subcommands are independent from function to function.*/ diff --git a/src/lists.h b/src/lists.h index 1afd0c0..9235b89 100644 --- a/src/lists.h +++ b/src/lists.h @@ -1,34 +1,34 @@ /** * @file lists.h * Lists Header file. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This source code, which was not part of the CircleMUD legacy code, * is attributed to: -* Copyright 2012 by Joseph Arnusch. +* Copyright 2012 by Joseph Arnusch. */ #ifndef _LISTS_HEADER #define _LISTS_HEADER struct item_data { - struct item_data * pPrevItem; - struct item_data * pNextItem; - void * pContent; + struct item_data * pPrevItem; + struct item_data * pNextItem; + void * pContent; }; struct list_data { - struct item_data * pFirstItem; - struct item_data * pLastItem; - unsigned short int iIterators; - unsigned short int iSize; + struct item_data * pFirstItem; + struct item_data * pLastItem; + unsigned short int iIterators; + unsigned short int iSize; }; struct iterator_data { - struct list_data * pList; - struct item_data * pItem; + struct list_data * pList; + struct item_data * pItem; }; /* Externals */ diff --git a/src/mail.h b/src/mail.h index dfba68e..93318bf 100644 --- a/src/mail.h +++ b/src/mail.h @@ -1,12 +1,12 @@ /** * @file mail.h * Public procs, macro defs, subcommand defines mudmail system. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * By Jeremy Elson. */ @@ -15,39 +15,39 @@ /* You can modify the following constants to fit your own MUD. */ -/* minimum level a player must be to send mail */ +/* minimum level a player must be to send mail */ #define MIN_MAIL_LEVEL 1 -/* # of gold coins required to send mail */ +/* # of gold coins required to send mail */ #define STAMP_PRICE 150 -/* Maximum size of mail in bytes (arbitrary) */ +/* Maximum size of mail in bytes (arbitrary) */ #define MAX_MAIL_SIZE 8192 -/* size of mail file allocation blocks */ +/* size of mail file allocation blocks */ #define BLOCK_SIZE 100 /* General, publicly available functions */ SPECIAL(postmaster); /* NOTE: Make sure that your block size is big enough. If not, HEADER_BLOCK_ - * DATASIZE will end up negative. This is a bad thing. Check the define below - * to make sure it is >0 when choosing values for NAME_SIZE and BLOCK_SIZE. + * DATASIZE will end up negative. This is a bad thing. Check the define below + * to make sure it is >0 when choosing values for NAME_SIZE and BLOCK_SIZE. * 100 is a nice round number for BLOCK_SIZE and is the default. The mail system * will always allocate disk space in chunks of size BLOCK_SIZE. */ /* DON'T TOUCH DEFINES BELOW. */ -int scan_file(void); -int has_mail(long recipient); -void store_mail(long to, long from, char *message_pointer); -char *read_delete(long recipient); +int scan_file(void); +int has_mail(long recipient); +void store_mail(long to, long from, char *message_pointer); +char *read_delete(long recipient); void notify_if_playing(struct char_data *from, int recipient_id); struct mail_t { - long recipient; - long sender; - time_t sent_time; - char *body; + long recipient; + long sender; + time_t sent_time; + char *body; }; /* old stuff below */ @@ -56,18 +56,17 @@ struct mail_t { #define DELETED_BLOCK (-3) /* Note: next_block is part of header_blk in a data block; we can't combine them - * here because we have to be able to differentiate a data block from a header + * here because we have to be able to differentiate a data block from a header * block when booting mail system. */ struct header_data_type { - long next_block; /* if header block, link to next block */ - long from; /* idnum of the mail's sender */ - long to; /* idnum of mail's recipient */ - time_t mail_time; /* when was the letter mailed? */ + long next_block; /* if header block, link to next block */ + long from; /* idnum of the mail's sender */ + long to; /* idnum of mail's recipient */ + time_t mail_time; /* when was the letter mailed? */ }; /* size of the data part of a header block */ -#define HEADER_BLOCK_DATASIZE \ - (BLOCK_SIZE - sizeof(long) - sizeof(struct header_data_type) - sizeof(char)) +#define HEADER_BLOCK_DATASIZE (BLOCK_SIZE - sizeof(long) - sizeof(struct header_data_type) - sizeof(char)) /* size of the data part of a data block */ #define DATA_BLOCK_DATASIZE (BLOCK_SIZE - sizeof(long) - sizeof(char)) @@ -76,31 +75,31 @@ struct header_data_type { terminating null character. */ struct header_block_type_d { - long block_type; /* is this a header or data block? */ - struct header_data_type header_data; /* other header data */ - char txt[HEADER_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */ + long block_type; /* is this a header or data block? */ + struct header_data_type header_data; /* other header data */ + char txt[HEADER_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */ }; struct data_block_type_d { - long block_type; /* -1 if header block, -2 if last data block - in mail, otherwise a link to the next */ - char txt[DATA_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */ + long block_type; /* -1 if header block, -2 if last data block + in mail, otherwise a link to the next */ + char txt[DATA_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */ }; typedef struct header_block_type_d header_block_type; typedef struct data_block_type_d data_block_type; struct position_list_type_d { - long position; - struct position_list_type_d *next; + long position; + struct position_list_type_d *next; }; typedef struct position_list_type_d position_list_type; struct mail_index_type_d { - long recipient; /* who is this mail for? */ - position_list_type *list_start; /* list of mail positions */ - struct mail_index_type_d *next; /* link to next one */ + long recipient; /* who is this mail for? */ + position_list_type *list_start; /* list of mail positions */ + struct mail_index_type_d *next; /* link to next one */ }; typedef struct mail_index_type_d mail_index_type; diff --git a/src/modify.h b/src/modify.h index 0fbdbd8..5f54b87 100644 --- a/src/modify.h +++ b/src/modify.h @@ -1,19 +1,19 @@ /** * @file modify.h * Header file for the modify module. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. -* -* @todo This module is originally defined as 'Run-time modification of game +* +* @todo This module is originally defined as 'Run-time modification of game * variables.' I believe it has digressed from the original intent. This * header file is created to help redefine (over time) what the heck modify.h * is. For example, publicly functions declared in comm.h but defined in modify.c -* should have their declarations moved here. +* should have their declarations moved here. * */ #ifndef _MODIFY_H_ diff --git a/src/msgedit.h b/src/msgedit.h index fdf893e..2a672b7 100644 --- a/src/msgedit.h +++ b/src/msgedit.h @@ -1,21 +1,21 @@ /** * Copyright 2012 Joseph Arnusch - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. - * + * **/ /* Externals */ diff --git a/src/mud_event.h b/src/mud_event.h index dc6feb9..3f68c8b 100644 --- a/src/mud_event.h +++ b/src/mud_event.h @@ -1,13 +1,13 @@ /** * @file mud_event.h * Mud_Event Header file. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This source code, which was not part of the CircleMUD legacy code, * is attributed to: -* Copyright 2012 by Joseph Arnusch. +* Copyright 2012 by Joseph Arnusch. */ #ifndef _MUD_EVENT_H_ @@ -30,17 +30,17 @@ typedef enum { } event_id; struct mud_event_list { - const char * event_name; - EVENTFUNC(*func); - int iEvent_Type; + const char * event_name; + EVENTFUNC(*func); + int iEvent_Type; }; struct mud_event_data { - struct event * pEvent; /***< Pointer reference to the event */ - event_id iId; /***< General ID reference */ - void * pStruct; /***< Pointer to NULL, Descriptor, Character .... */ - char * sVariables; /***< String variable */ -}; + struct event * pEvent; /***< Pointer reference to the event */ + event_id iId; /***< General ID reference */ + void * pStruct; /***< Pointer to NULL, Descriptor, Character .... */ + char * sVariables; /***< String variable */ +}; /* Externals */ extern struct list_data * world_events; diff --git a/src/oasis.h b/src/oasis.h index 8268a89..f6b6907 100644 --- a/src/oasis.h +++ b/src/oasis.h @@ -14,11 +14,11 @@ #include "utils.h" /* for ACMD macro */ -#define _OASISOLC 0x206 /* 2.0.6 */ +#define _OASISOLC 0x206 /* 2.0.6 */ /* Used to determine what version of OasisOLC is installed. Ex: #if _OASISOLC >= OASIS_VERSION(2,0,0) */ -#define OASIS_VERSION(x,y,z) (((x) << 8 | (y) << 4 | (z)) +#define OASIS_VERSION(x,y,z) (((x) << 8 | (y) << 4 | (z)) #define AEDIT_PERMISSION 999 /* arbitrary number higher than max zone vnum*/ #define HEDIT_PERMISSION 888 /* arbitrary number higher then max zone vnum*/ @@ -28,22 +28,22 @@ to adjust these numbers if you ever add more. Note: Most of the NUM_ and MAX_ limits have been moved to more appropriate locations. */ -#define TOGGLE_VAR(var) if (var == YES) { var = NO; } else { var = YES; } +#define TOGGLE_VAR(var) if (var == YES) { var = NO; } else { var = YES; } #define CHECK_VAR(var) ((var == YES) ? "Yes" : "No") #define MAX_PEOPLE 10 /* Max # of people you want to sit in furniture. */ /* Limit information. */ /* Name size increased due to larger colour/mxp codes. -Vatiken */ -#define MAX_ROOM_NAME 150 -#define MAX_MOB_NAME 100 -#define MAX_OBJ_NAME 100 -#define MAX_ROOM_DESC 2048 -#define MAX_EXIT_DESC 256 -#define MAX_EXTRA_DESC 512 -#define MAX_MOB_DESC 1024 -#define MAX_OBJ_DESC 512 -#define MAX_DUPLICATES 100 /* when loading in zedit */ +#define MAX_ROOM_NAME 150 +#define MAX_MOB_NAME 100 +#define MAX_OBJ_NAME 100 +#define MAX_ROOM_DESC 2048 +#define MAX_EXIT_DESC 256 +#define MAX_EXTRA_DESC 512 +#define MAX_MOB_DESC 1024 +#define MAX_OBJ_DESC 512 +#define MAX_DUPLICATES 100 /* when loading in zedit */ /* arbitrary limits - roll your own */ /* max weapon is 50d50 .. avg. 625 dam... */ @@ -67,12 +67,12 @@ #define BIT_STRING_LENGTH 33 /* The data types for miscellaneous functions. */ -#define OASIS_WLD 0 -#define OASIS_MOB 1 -#define OASIS_OBJ 2 -#define OASIS_ZON 3 -#define OASIS_EXI 4 -#define OASIS_CFG 5 +#define OASIS_WLD 0 +#define OASIS_MOB 1 +#define OASIS_OBJ 2 +#define OASIS_ZON 3 +#define OASIS_EXI 4 +#define OASIS_CFG 5 /* Utilities exported from oasis.c. */ void cleanup_olc(struct descriptor_data *d, byte cleanup_type); @@ -84,30 +84,30 @@ void send_cannot_edit(struct char_data *ch, zone_vnum zone); /* NO and YES are defined in utils.h. Removed from here. */ struct oasis_olc_data { - int mode; /* how to parse input */ - zone_rnum zone_num; /* current zone */ - room_vnum number; /* vnum of subject */ - int value; /* mostly 'has changed' flag*/ - char *storage; /* used for 'tedit' */ - struct char_data *mob; /* used for 'medit' */ - struct room_data *room; /* used for 'redit' */ - struct obj_data *obj; /* used for 'oedit' */ - struct zone_data *zone; /* used for 'zedit' */ - struct shop_data *shop; /* used for 'sedit' */ - struct config_data *config; /* used for 'cedit' */ - struct aq_data *quest; /* used for 'qedit' */ - struct extra_descr_data *desc; /* used in '[r|o|m]edit' */ - struct social_messg *action; /* Aedit uses this one */ - struct trig_data *trig; - struct prefs_data *prefs; /* used for 'prefedit' */ - struct ibt_data *ibt; /* used for 'ibtedit' */ - struct message_list *msg; - struct message_type *m_type; - int script_mode; - int trigger_position; - int item_type; - struct trig_proto_list *script; /* for assigning triggers in [r|o|m]edit*/ - struct help_index_element*help; /* Hedit uses this */ + int mode; /* how to parse input */ + zone_rnum zone_num; /* current zone */ + room_vnum number; /* vnum of subject */ + int value; /* mostly 'has changed' flag*/ + char *storage; /* used for 'tedit' */ + struct char_data *mob; /* used for 'medit' */ + struct room_data *room; /* used for 'redit' */ + struct obj_data *obj; /* used for 'oedit' */ + struct zone_data *zone; /* used for 'zedit' */ + struct shop_data *shop; /* used for 'sedit' */ + struct config_data *config; /* used for 'cedit' */ + struct aq_data *quest; /* used for 'qedit' */ + struct extra_descr_data *desc; /* used in '[r|o|m]edit' */ + struct social_messg *action; /* Aedit uses this one */ + struct trig_data *trig; + struct prefs_data *prefs; /* used for 'prefedit' */ + struct ibt_data *ibt; /* used for 'ibtedit' */ + struct message_list *msg; + struct message_type *m_type; + int script_mode; + int trigger_position; + int item_type; + struct trig_proto_list *script; /* for assigning triggers in [r|o|m]edit*/ + struct help_index_element *help; /* Hedit uses this */ }; /* Exported globals. */ @@ -115,22 +115,22 @@ extern const char *nrm, *grn, *cyn, *yel; /* Descriptor access macros. */ #define OLC(d) ((d)->olc) -#define OLC_MODE(d) (OLC(d)->mode) /**< Parse input mode. */ -#define OLC_NUM(d) (OLC(d)->number) /**< Room/Obj VNUM. */ -#define OLC_VAL(d) (OLC(d)->value) /**< Scratch variable. */ -#define OLC_ZNUM(d) (OLC(d)->zone_num) /**< Real zone number. */ +#define OLC_MODE(d) (OLC(d)->mode) /**< Parse input mode. */ +#define OLC_NUM(d) (OLC(d)->number) /**< Room/Obj VNUM. */ +#define OLC_VAL(d) (OLC(d)->value) /**< Scratch variable. */ +#define OLC_ZNUM(d) (OLC(d)->zone_num) /**< Real zone number. */ -#define OLC_STORAGE(d) (OLC(d)->storage) /**< char pointer. */ -#define OLC_ROOM(d) (OLC(d)->room) /**< Room structure. */ -#define OLC_OBJ(d) (OLC(d)->obj) /**< Object structure. */ -#define OLC_ZONE(d) (OLC(d)->zone) /**< Zone structure. */ -#define OLC_MOB(d) (OLC(d)->mob) /**< Mob structure. */ -#define OLC_SHOP(d) (OLC(d)->shop) /**< Shop structure. */ -#define OLC_DESC(d) (OLC(d)->desc) /**< Extra description. */ -#define OLC_CONFIG(d) (OLC(d)->config) /**< Config structure. */ +#define OLC_STORAGE(d) (OLC(d)->storage) /**< char pointer. */ +#define OLC_ROOM(d) (OLC(d)->room) /**< Room structure. */ +#define OLC_OBJ(d) (OLC(d)->obj) /**< Object structure. */ +#define OLC_ZONE(d) (OLC(d)->zone) /**< Zone structure. */ +#define OLC_MOB(d) (OLC(d)->mob) /**< Mob structure. */ +#define OLC_SHOP(d) (OLC(d)->shop) /**< Shop structure. */ +#define OLC_DESC(d) (OLC(d)->desc) /**< Extra description. */ +#define OLC_CONFIG(d) (OLC(d)->config) /**< Config structure. */ #define OLC_TRIG(d) (OLC(d)->trig) /**< Trigger structure. */ #define OLC_QUEST(d) (OLC(d)->quest) /**< Quest structure */ -#define OLC_MSG_LIST(d) (OLC(d)->msg) /**< Message structure */ +#define OLC_MSG_LIST(d) (OLC(d)->msg) /**< Message structure */ #define OLC_ACTION(d) (OLC(d)->action) /**< Action structure */ #define OLC_HELP(d) (OLC(d)->help) /**< Hedit structure */ @@ -141,9 +141,9 @@ extern const char *nrm, *grn, *cyn, *yel; #define OLC_MSG(d) (OLC(d)->m_type) /* Cleanup types. */ -#define CLEANUP_ALL 1 /* Free the whole lot. */ -#define CLEANUP_STRUCTS 2 /* Don't free strings. */ -#define CLEANUP_CONFIG 3 /* Used just to send proper message. */ +#define CLEANUP_ALL 1 /* Free the whole lot. */ +#define CLEANUP_STRUCTS 2 /* Don't free strings. */ +#define CLEANUP_CONFIG 3 /* Used just to send proper message. */ /* Submodes of AEDIT connectedness */ #define AEDIT_CONFIRM_SAVESTRING 0 @@ -171,82 +171,82 @@ extern const char *nrm, *grn, *cyn, *yel; #define AEDIT_OBJ_OTHERS_FOUND 22 /* Submodes of OEDIT connectedness. */ -#define OEDIT_MAIN_MENU 1 -#define OEDIT_KEYWORD 2 -#define OEDIT_SHORTDESC 3 -#define OEDIT_LONGDESC 4 -#define OEDIT_ACTDESC 5 -#define OEDIT_TYPE 6 -#define OEDIT_EXTRAS 7 -#define OEDIT_WEAR 8 -#define OEDIT_WEIGHT 9 -#define OEDIT_COST 10 -#define OEDIT_COSTPERDAY 11 -#define OEDIT_TIMER 12 -#define OEDIT_VALUE_1 13 -#define OEDIT_VALUE_2 14 -#define OEDIT_VALUE_3 15 -#define OEDIT_VALUE_4 16 -#define OEDIT_APPLY 17 -#define OEDIT_APPLYMOD 18 -#define OEDIT_EXTRADESC_KEY 19 -#define OEDIT_CONFIRM_SAVEDB 20 -#define OEDIT_CONFIRM_SAVESTRING 21 -#define OEDIT_PROMPT_APPLY 22 -#define OEDIT_EXTRADESC_DESCRIPTION 23 -#define OEDIT_EXTRADESC_MENU 24 -#define OEDIT_LEVEL 25 -#define OEDIT_PERM 26 +#define OEDIT_MAIN_MENU 1 +#define OEDIT_KEYWORD 2 +#define OEDIT_SHORTDESC 3 +#define OEDIT_LONGDESC 4 +#define OEDIT_ACTDESC 5 +#define OEDIT_TYPE 6 +#define OEDIT_EXTRAS 7 +#define OEDIT_WEAR 8 +#define OEDIT_WEIGHT 9 +#define OEDIT_COST 10 +#define OEDIT_COSTPERDAY 11 +#define OEDIT_TIMER 12 +#define OEDIT_VALUE_1 13 +#define OEDIT_VALUE_2 14 +#define OEDIT_VALUE_3 15 +#define OEDIT_VALUE_4 16 +#define OEDIT_APPLY 17 +#define OEDIT_APPLYMOD 18 +#define OEDIT_EXTRADESC_KEY 19 +#define OEDIT_CONFIRM_SAVEDB 20 +#define OEDIT_CONFIRM_SAVESTRING 21 +#define OEDIT_PROMPT_APPLY 22 +#define OEDIT_EXTRADESC_DESCRIPTION 23 +#define OEDIT_EXTRADESC_MENU 24 +#define OEDIT_LEVEL 25 +#define OEDIT_PERM 26 #define OEDIT_DELETE 27 #define OEDIT_COPY 28 /* Submodes of REDIT connectedness. */ -#define REDIT_MAIN_MENU 1 -#define REDIT_NAME 2 -#define REDIT_DESC 3 -#define REDIT_FLAGS 4 -#define REDIT_SECTOR 5 -#define REDIT_EXIT_MENU 6 -#define REDIT_CONFIRM_SAVEDB 7 -#define REDIT_CONFIRM_SAVESTRING 8 -#define REDIT_EXIT_NUMBER 9 -#define REDIT_EXIT_DESCRIPTION 10 -#define REDIT_EXIT_KEYWORD 11 -#define REDIT_EXIT_KEY 12 -#define REDIT_EXIT_DOORFLAGS 13 -#define REDIT_EXTRADESC_MENU 14 -#define REDIT_EXTRADESC_KEY 15 -#define REDIT_EXTRADESC_DESCRIPTION 16 -#define REDIT_DELETE 17 -#define REDIT_COPY 18 +#define REDIT_MAIN_MENU 1 +#define REDIT_NAME 2 +#define REDIT_DESC 3 +#define REDIT_FLAGS 4 +#define REDIT_SECTOR 5 +#define REDIT_EXIT_MENU 6 +#define REDIT_CONFIRM_SAVEDB 7 +#define REDIT_CONFIRM_SAVESTRING 8 +#define REDIT_EXIT_NUMBER 9 +#define REDIT_EXIT_DESCRIPTION 10 +#define REDIT_EXIT_KEYWORD 11 +#define REDIT_EXIT_KEY 12 +#define REDIT_EXIT_DOORFLAGS 13 +#define REDIT_EXTRADESC_MENU 14 +#define REDIT_EXTRADESC_KEY 15 +#define REDIT_EXTRADESC_DESCRIPTION 16 +#define REDIT_DELETE 17 +#define REDIT_COPY 18 /* Submodes of ZEDIT connectedness. */ -#define ZEDIT_MAIN_MENU 0 -#define ZEDIT_DELETE_ENTRY 1 -#define ZEDIT_NEW_ENTRY 2 -#define ZEDIT_CHANGE_ENTRY 3 -#define ZEDIT_COMMAND_TYPE 4 -#define ZEDIT_IF_FLAG 5 -#define ZEDIT_ARG1 6 -#define ZEDIT_ARG2 7 -#define ZEDIT_ARG3 8 -#define ZEDIT_ZONE_NAME 9 -#define ZEDIT_ZONE_LIFE 10 -#define ZEDIT_ZONE_BOT 11 -#define ZEDIT_ZONE_TOP 12 -#define ZEDIT_ZONE_RESET 13 -#define ZEDIT_CONFIRM_SAVESTRING 14 -#define ZEDIT_ZONE_BUILDERS 15 -#define ZEDIT_SARG1 20 -#define ZEDIT_SARG2 21 -#define ZEDIT_ZONE_FLAGS 22 -#define ZEDIT_LEVELS 23 -#define ZEDIT_LEV_MIN 24 -#define ZEDIT_LEV_MAX 25 -#define ZEDIT_ZONE_CLAIM 26 +#define ZEDIT_MAIN_MENU 0 +#define ZEDIT_DELETE_ENTRY 1 +#define ZEDIT_NEW_ENTRY 2 +#define ZEDIT_CHANGE_ENTRY 3 +#define ZEDIT_COMMAND_TYPE 4 +#define ZEDIT_IF_FLAG 5 +#define ZEDIT_ARG1 6 +#define ZEDIT_ARG2 7 +#define ZEDIT_ARG3 8 +#define ZEDIT_ZONE_NAME 9 +#define ZEDIT_ZONE_LIFE 10 +#define ZEDIT_ZONE_BOT 11 +#define ZEDIT_ZONE_TOP 12 +#define ZEDIT_ZONE_RESET 13 +#define ZEDIT_CONFIRM_SAVESTRING 14 +#define ZEDIT_ZONE_BUILDERS 15 +#define ZEDIT_SARG1 20 +#define ZEDIT_SARG2 21 +#define ZEDIT_ZONE_FLAGS 22 +#define ZEDIT_LEVELS 23 +#define ZEDIT_LEV_MIN 24 +#define ZEDIT_LEV_MAX 25 +#define ZEDIT_ZONE_CLAIM 26 /* Submodes of MEDIT connectedness. */ -#define MEDIT_MAIN_MENU 0 +#define MEDIT_MAIN_MENU 0 #define MEDIT_KEYWORD 1 #define MEDIT_S_DESC 2 #define MEDIT_L_DESC 3 @@ -257,129 +257,129 @@ extern const char *nrm, *grn, *cyn, *yel; #define MEDIT_STATS_MENU 8 /* Numerical responses. */ -#define MEDIT_NUMERICAL_RESPONSE 10 -#define MEDIT_SEX 11 -#define MEDIT_HITROLL 12 -#define MEDIT_DAMROLL 13 -#define MEDIT_NDD 14 -#define MEDIT_SDD 15 -#define MEDIT_NUM_HP_DICE 16 -#define MEDIT_SIZE_HP_DICE 17 -#define MEDIT_ADD_HP 18 -#define MEDIT_AC 19 -#define MEDIT_EXP 20 -#define MEDIT_GOLD 21 -#define MEDIT_POS 22 -#define MEDIT_DEFAULT_POS 23 -#define MEDIT_ATTACK 24 -#define MEDIT_LEVEL 25 -#define MEDIT_ALIGNMENT 26 -#define MEDIT_DELETE 27 -#define MEDIT_COPY 28 -#define MEDIT_STR 29 -#define MEDIT_INT 30 -#define MEDIT_WIS 31 -#define MEDIT_DEX 32 -#define MEDIT_CON 33 -#define MEDIT_CHA 34 -#define MEDIT_PARA 35 -#define MEDIT_ROD 36 -#define MEDIT_PETRI 37 -#define MEDIT_BREATH 38 -#define MEDIT_SPELL 39 +#define MEDIT_NUMERICAL_RESPONSE 10 +#define MEDIT_SEX 11 +#define MEDIT_HITROLL 12 +#define MEDIT_DAMROLL 13 +#define MEDIT_NDD 14 +#define MEDIT_SDD 15 +#define MEDIT_NUM_HP_DICE 16 +#define MEDIT_SIZE_HP_DICE 17 +#define MEDIT_ADD_HP 18 +#define MEDIT_AC 19 +#define MEDIT_EXP 20 +#define MEDIT_GOLD 21 +#define MEDIT_POS 22 +#define MEDIT_DEFAULT_POS 23 +#define MEDIT_ATTACK 24 +#define MEDIT_LEVEL 25 +#define MEDIT_ALIGNMENT 26 +#define MEDIT_DELETE 27 +#define MEDIT_COPY 28 +#define MEDIT_STR 29 +#define MEDIT_INT 30 +#define MEDIT_WIS 31 +#define MEDIT_DEX 32 +#define MEDIT_CON 33 +#define MEDIT_CHA 34 +#define MEDIT_PARA 35 +#define MEDIT_ROD 36 +#define MEDIT_PETRI 37 +#define MEDIT_BREATH 38 +#define MEDIT_SPELL 39 /* Submodes of SEDIT connectedness. */ -#define SEDIT_MAIN_MENU 0 -#define SEDIT_CONFIRM_SAVESTRING 1 -#define SEDIT_NOITEM1 2 -#define SEDIT_NOITEM2 3 -#define SEDIT_NOCASH1 4 -#define SEDIT_NOCASH2 5 -#define SEDIT_NOBUY 6 -#define SEDIT_BUY 7 -#define SEDIT_SELL 8 -#define SEDIT_PRODUCTS_MENU 11 -#define SEDIT_ROOMS_MENU 12 -#define SEDIT_NAMELIST_MENU 13 -#define SEDIT_NAMELIST 14 -#define SEDIT_COPY 15 +#define SEDIT_MAIN_MENU 0 +#define SEDIT_CONFIRM_SAVESTRING 1 +#define SEDIT_NOITEM1 2 +#define SEDIT_NOITEM2 3 +#define SEDIT_NOCASH1 4 +#define SEDIT_NOCASH2 5 +#define SEDIT_NOBUY 6 +#define SEDIT_BUY 7 +#define SEDIT_SELL 8 +#define SEDIT_PRODUCTS_MENU 11 +#define SEDIT_ROOMS_MENU 12 +#define SEDIT_NAMELIST_MENU 13 +#define SEDIT_NAMELIST 14 +#define SEDIT_COPY 15 -#define SEDIT_NUMERICAL_RESPONSE 20 -#define SEDIT_OPEN1 21 -#define SEDIT_OPEN2 22 -#define SEDIT_CLOSE1 23 -#define SEDIT_CLOSE2 24 -#define SEDIT_KEEPER 25 -#define SEDIT_BUY_PROFIT 26 -#define SEDIT_SELL_PROFIT 27 -#define SEDIT_TYPE_MENU 29 -#define SEDIT_DELETE_TYPE 30 -#define SEDIT_DELETE_PRODUCT 31 -#define SEDIT_NEW_PRODUCT 32 -#define SEDIT_DELETE_ROOM 33 -#define SEDIT_NEW_ROOM 34 -#define SEDIT_SHOP_FLAGS 35 -#define SEDIT_NOTRADE 36 +#define SEDIT_NUMERICAL_RESPONSE 20 +#define SEDIT_OPEN1 21 +#define SEDIT_OPEN2 22 +#define SEDIT_CLOSE1 23 +#define SEDIT_CLOSE2 24 +#define SEDIT_KEEPER 25 +#define SEDIT_BUY_PROFIT 26 +#define SEDIT_SELL_PROFIT 27 +#define SEDIT_TYPE_MENU 29 +#define SEDIT_DELETE_TYPE 30 +#define SEDIT_DELETE_PRODUCT 31 +#define SEDIT_NEW_PRODUCT 32 +#define SEDIT_DELETE_ROOM 33 +#define SEDIT_NEW_ROOM 34 +#define SEDIT_SHOP_FLAGS 35 +#define SEDIT_NOTRADE 36 /* Submodes of CEDIT connectedness. */ -#define CEDIT_MAIN_MENU 0 -#define CEDIT_CONFIRM_SAVESTRING 1 -#define CEDIT_GAME_OPTIONS_MENU 2 -#define CEDIT_CRASHSAVE_OPTIONS_MENU 3 -#define CEDIT_OPERATION_OPTIONS_MENU 4 -#define CEDIT_DISP_EXPERIENCE_MENU 5 -#define CEDIT_ROOM_NUMBERS_MENU 6 -#define CEDIT_AUTOWIZ_OPTIONS_MENU 7 -#define CEDIT_OK 8 -#define CEDIT_HUH 9 -#define CEDIT_NOPERSON 10 -#define CEDIT_NOEFFECT 11 -#define CEDIT_DFLT_IP 12 -#define CEDIT_DFLT_DIR 13 -#define CEDIT_LOGNAME 14 -#define CEDIT_MENU 15 -#define CEDIT_WELC_MESSG 16 -#define CEDIT_START_MESSG 17 +#define CEDIT_MAIN_MENU 0 +#define CEDIT_CONFIRM_SAVESTRING 1 +#define CEDIT_GAME_OPTIONS_MENU 2 +#define CEDIT_CRASHSAVE_OPTIONS_MENU 3 +#define CEDIT_OPERATION_OPTIONS_MENU 4 +#define CEDIT_DISP_EXPERIENCE_MENU 5 +#define CEDIT_ROOM_NUMBERS_MENU 6 +#define CEDIT_AUTOWIZ_OPTIONS_MENU 7 +#define CEDIT_OK 8 +#define CEDIT_HUH 9 +#define CEDIT_NOPERSON 10 +#define CEDIT_NOEFFECT 11 +#define CEDIT_DFLT_IP 12 +#define CEDIT_DFLT_DIR 13 +#define CEDIT_LOGNAME 14 +#define CEDIT_MENU 15 +#define CEDIT_WELC_MESSG 16 +#define CEDIT_START_MESSG 17 /* Numerical responses. */ -#define CEDIT_NUMERICAL_RESPONSE 20 -#define CEDIT_LEVEL_CAN_SHOUT 21 -#define CEDIT_HOLLER_MOVE_COST 22 -#define CEDIT_TUNNEL_SIZE 23 -#define CEDIT_MAX_EXP_GAIN 24 -#define CEDIT_MAX_EXP_LOSS 25 -#define CEDIT_MAX_NPC_CORPSE_TIME 26 -#define CEDIT_MAX_PC_CORPSE_TIME 27 -#define CEDIT_IDLE_VOID 28 -#define CEDIT_IDLE_RENT_TIME 29 -#define CEDIT_IDLE_MAX_LEVEL 30 -#define CEDIT_DTS_ARE_DUMPS 31 -#define CEDIT_LOAD_INTO_INVENTORY 32 -#define CEDIT_TRACK_THROUGH_DOORS 33 -#define CEDIT_NO_MORT_TO_IMMORT 34 -#define CEDIT_MAX_OBJ_SAVE 35 -#define CEDIT_MIN_RENT_COST 36 -#define CEDIT_AUTOSAVE_TIME 37 -#define CEDIT_CRASH_FILE_TIMEOUT 38 -#define CEDIT_RENT_FILE_TIMEOUT 39 -#define CEDIT_MORTAL_START_ROOM 40 -#define CEDIT_IMMORT_START_ROOM 41 -#define CEDIT_FROZEN_START_ROOM 42 -#define CEDIT_DONATION_ROOM_1 43 -#define CEDIT_DONATION_ROOM_2 44 -#define CEDIT_DONATION_ROOM_3 45 -#define CEDIT_DFLT_PORT 46 -#define CEDIT_MAX_PLAYING 47 -#define CEDIT_MAX_FILESIZE 48 -#define CEDIT_MAX_BAD_PWS 49 -#define CEDIT_SITEOK_EVERYONE 50 -#define CEDIT_NAMESERVER_IS_SLOW 51 -#define CEDIT_USE_AUTOWIZ 52 -#define CEDIT_MIN_WIZLIST_LEV 53 -#define CEDIT_MAP_OPTION 54 -#define CEDIT_MAP_SIZE 55 -#define CEDIT_MINIMAP_SIZE 56 -#define CEDIT_DEBUG_MODE 57 +#define CEDIT_NUMERICAL_RESPONSE 20 +#define CEDIT_LEVEL_CAN_SHOUT 21 +#define CEDIT_HOLLER_MOVE_COST 22 +#define CEDIT_TUNNEL_SIZE 23 +#define CEDIT_MAX_EXP_GAIN 24 +#define CEDIT_MAX_EXP_LOSS 25 +#define CEDIT_MAX_NPC_CORPSE_TIME 26 +#define CEDIT_MAX_PC_CORPSE_TIME 27 +#define CEDIT_IDLE_VOID 28 +#define CEDIT_IDLE_RENT_TIME 29 +#define CEDIT_IDLE_MAX_LEVEL 30 +#define CEDIT_DTS_ARE_DUMPS 31 +#define CEDIT_LOAD_INTO_INVENTORY 32 +#define CEDIT_TRACK_THROUGH_DOORS 33 +#define CEDIT_NO_MORT_TO_IMMORT 34 +#define CEDIT_MAX_OBJ_SAVE 35 +#define CEDIT_MIN_RENT_COST 36 +#define CEDIT_AUTOSAVE_TIME 37 +#define CEDIT_CRASH_FILE_TIMEOUT 38 +#define CEDIT_RENT_FILE_TIMEOUT 39 +#define CEDIT_MORTAL_START_ROOM 40 +#define CEDIT_IMMORT_START_ROOM 41 +#define CEDIT_FROZEN_START_ROOM 42 +#define CEDIT_DONATION_ROOM_1 43 +#define CEDIT_DONATION_ROOM_2 44 +#define CEDIT_DONATION_ROOM_3 45 +#define CEDIT_DFLT_PORT 46 +#define CEDIT_MAX_PLAYING 47 +#define CEDIT_MAX_FILESIZE 48 +#define CEDIT_MAX_BAD_PWS 49 +#define CEDIT_SITEOK_EVERYONE 50 +#define CEDIT_NAMESERVER_IS_SLOW 51 +#define CEDIT_USE_AUTOWIZ 52 +#define CEDIT_MIN_WIZLIST_LEV 53 +#define CEDIT_MAP_OPTION 54 +#define CEDIT_MAP_SIZE 55 +#define CEDIT_MINIMAP_SIZE 56 +#define CEDIT_DEBUG_MODE 57 /* Hedit Submodes of connectedness. */ #define HEDIT_CONFIRM_SAVESTRING 0 diff --git a/src/pfdefaults.h b/src/pfdefaults.h index c0eba7e..e483ca4 100644 --- a/src/pfdefaults.h +++ b/src/pfdefaults.h @@ -1,7 +1,7 @@ /** * @file pfdefaults.h * ASCII player file defaults. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. * @@ -10,56 +10,56 @@ #ifndef _PFDEFAULTS_H_ #define _PFDEFAULTS_H_ -/* WARNING: Do not change the values below if you have existing ascii player +/* WARNING: Do not change the values below if you have existing ascii player * files you don't want to screw up. */ -#define PFDEF_SEX 0 -#define PFDEF_CLASS 0 -#define PFDEF_LEVEL 0 -#define PFDEF_HEIGHT 0 -#define PFDEF_WEIGHT 0 -#define PFDEF_ALIGNMENT 0 -#define PFDEF_PLRFLAGS 0 -#define PFDEF_AFFFLAGS 0 -#define PFDEF_SAVETHROW 0 -#define PFDEF_LOADROOM 0 -#define PFDEF_INVISLEV 0 -#define PFDEF_FREEZELEV 0 -#define PFDEF_WIMPLEV 0 -#define PFDEF_CONDITION 0 -#define PFDEF_BADPWS 0 -#define PFDEF_PREFFLAGS 0 -#define PFDEF_PRACTICES 0 -#define PFDEF_GOLD 0 -#define PFDEF_BANK 0 -#define PFDEF_EXP 0 -#define PFDEF_HITROLL 0 -#define PFDEF_DAMROLL 0 -#define PFDEF_AC 0 -#define PFDEF_STR 0 -#define PFDEF_STRADD 0 -#define PFDEF_DEX 0 -#define PFDEF_INT 0 -#define PFDEF_WIS 0 -#define PFDEF_CON 0 -#define PFDEF_CHA 0 -#define PFDEF_HIT 0 -#define PFDEF_MAXHIT 0 -#define PFDEF_MANA 0 -#define PFDEF_MAXMANA 0 -#define PFDEF_MOVE 0 -#define PFDEF_MAXMOVE 0 -#define PFDEF_HUNGER 0 -#define PFDEF_THIRST 0 -#define PFDEF_DRUNK 0 -#define PFDEF_OLC NOWHERE -#define PFDEF_PAGELENGTH 22 -#define PFDEF_SCREENWIDTH 80 -#define PFDEF_QUESTPOINTS 0 -#define PFDEF_QUESTCOUNT 0 -#define PFDEF_COMPQUESTS 0 -#define PFDEF_CURRQUEST NOTHING -#define PFDEF_LASTMOTD 0 -#define PFDEF_LASTNEWS 0 +#define PFDEF_SEX 0 +#define PFDEF_CLASS 0 +#define PFDEF_LEVEL 0 +#define PFDEF_HEIGHT 0 +#define PFDEF_WEIGHT 0 +#define PFDEF_ALIGNMENT 0 +#define PFDEF_PLRFLAGS 0 +#define PFDEF_AFFFLAGS 0 +#define PFDEF_SAVETHROW 0 +#define PFDEF_LOADROOM 0 +#define PFDEF_INVISLEV 0 +#define PFDEF_FREEZELEV 0 +#define PFDEF_WIMPLEV 0 +#define PFDEF_CONDITION 0 +#define PFDEF_BADPWS 0 +#define PFDEF_PREFFLAGS 0 +#define PFDEF_PRACTICES 0 +#define PFDEF_GOLD 0 +#define PFDEF_BANK 0 +#define PFDEF_EXP 0 +#define PFDEF_HITROLL 0 +#define PFDEF_DAMROLL 0 +#define PFDEF_AC 0 +#define PFDEF_STR 0 +#define PFDEF_STRADD 0 +#define PFDEF_DEX 0 +#define PFDEF_INT 0 +#define PFDEF_WIS 0 +#define PFDEF_CON 0 +#define PFDEF_CHA 0 +#define PFDEF_HIT 0 +#define PFDEF_MAXHIT 0 +#define PFDEF_MANA 0 +#define PFDEF_MAXMANA 0 +#define PFDEF_MOVE 0 +#define PFDEF_MAXMOVE 0 +#define PFDEF_HUNGER 0 +#define PFDEF_THIRST 0 +#define PFDEF_DRUNK 0 +#define PFDEF_OLC NOWHERE +#define PFDEF_PAGELENGTH 22 +#define PFDEF_SCREENWIDTH 80 +#define PFDEF_QUESTPOINTS 0 +#define PFDEF_QUESTCOUNT 0 +#define PFDEF_COMPQUESTS 0 +#define PFDEF_CURRQUEST NOTHING +#define PFDEF_LASTMOTD 0 +#define PFDEF_LASTNEWS 0 #endif /* _PFDEFAULTS_H_ */ diff --git a/src/prefedit.h b/src/prefedit.h old mode 100755 new mode 100644 index 4ae2ccc..65ab3d0 --- a/src/prefedit.h +++ b/src/prefedit.h @@ -10,13 +10,12 @@ **************************************************************************/ /* Toggle structure held for OLC purposes */ -struct prefs_data -{ - struct char_data *ch; /* Pointer to char being edited */ - int pref_flags[PR_ARRAY_MAX]; /* Copy of player's pref flags */ - int wimp_level; /* Copy of player's wimp level */ - int page_length; /* Copy of player's pagelength */ - int screen_width; /* Copy of player's screenwidth */ +struct prefs_data { + struct char_data *ch; /* Pointer to char being edited */ + int pref_flags[PR_ARRAY_MAX]; /* Copy of player's pref flags */ + int wimp_level; /* Copy of player's wimp level */ + int page_length; /* Copy of player's pagelength */ + int screen_width; /* Copy of player's screenwidth */ }; /* Prefedit utility macros */ diff --git a/src/protocol.h b/src/protocol.h index 09200e7..6b24e81 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -71,149 +71,142 @@ typedef struct descriptor_data descriptor_t; Types. ******************************************************************************/ -typedef enum -{ - false, - true +typedef enum { + false, + true } bool_t; -typedef enum -{ - eUNKNOWN, - eNO, - eSOMETIMES, - eYES +typedef enum { + eUNKNOWN, + eNO, + eSOMETIMES, + eYES } support_t; -typedef enum -{ - eMSDP_NONE = -1, /* This must always be first. */ +typedef enum { + eMSDP_NONE = -1, /* This must always be first. */ - /* General */ - eMSDP_CHARACTER_NAME, - eMSDP_SERVER_ID, - eMSDP_SERVER_TIME, - eMSDP_SNIPPET_VERSION, + /* General */ + eMSDP_CHARACTER_NAME, + eMSDP_SERVER_ID, + eMSDP_SERVER_TIME, + eMSDP_SNIPPET_VERSION, - /* Character */ - eMSDP_AFFECTS, - eMSDP_ALIGNMENT, - eMSDP_EXPERIENCE, - eMSDP_EXPERIENCE_MAX, - eMSDP_EXPERIENCE_TNL, - eMSDP_HEALTH, - eMSDP_HEALTH_MAX, - eMSDP_LEVEL, - eMSDP_RACE, - eMSDP_CLASS, - eMSDP_MANA, - eMSDP_MANA_MAX, - eMSDP_WIMPY, - eMSDP_PRACTICE, - eMSDP_MONEY, - eMSDP_MOVEMENT, - eMSDP_MOVEMENT_MAX, - eMSDP_HITROLL, - eMSDP_DAMROLL, - eMSDP_AC, - eMSDP_STR, - eMSDP_INT, - eMSDP_WIS, - eMSDP_DEX, - eMSDP_CON, - eMSDP_STR_PERM, - eMSDP_INT_PERM, - eMSDP_WIS_PERM, - eMSDP_DEX_PERM, - eMSDP_CON_PERM, + /* Character */ + eMSDP_AFFECTS, + eMSDP_ALIGNMENT, + eMSDP_EXPERIENCE, + eMSDP_EXPERIENCE_MAX, + eMSDP_EXPERIENCE_TNL, + eMSDP_HEALTH, + eMSDP_HEALTH_MAX, + eMSDP_LEVEL, + eMSDP_RACE, + eMSDP_CLASS, + eMSDP_MANA, + eMSDP_MANA_MAX, + eMSDP_WIMPY, + eMSDP_PRACTICE, + eMSDP_MONEY, + eMSDP_MOVEMENT, + eMSDP_MOVEMENT_MAX, + eMSDP_HITROLL, + eMSDP_DAMROLL, + eMSDP_AC, + eMSDP_STR, + eMSDP_INT, + eMSDP_WIS, + eMSDP_DEX, + eMSDP_CON, + eMSDP_STR_PERM, + eMSDP_INT_PERM, + eMSDP_WIS_PERM, + eMSDP_DEX_PERM, + eMSDP_CON_PERM, - /* Combat */ - eMSDP_OPPONENT_HEALTH, - eMSDP_OPPONENT_HEALTH_MAX, - eMSDP_OPPONENT_LEVEL, - eMSDP_OPPONENT_NAME, + /* Combat */ + eMSDP_OPPONENT_HEALTH, + eMSDP_OPPONENT_HEALTH_MAX, + eMSDP_OPPONENT_LEVEL, + eMSDP_OPPONENT_NAME, - /* World */ - eMSDP_AREA_NAME, - eMSDP_ROOM_EXITS, - eMSDP_ROOM_NAME, - eMSDP_ROOM_VNUM, - eMSDP_WORLD_TIME, + /* World */ + eMSDP_AREA_NAME, + eMSDP_ROOM_EXITS, + eMSDP_ROOM_NAME, + eMSDP_ROOM_VNUM, + eMSDP_WORLD_TIME, - /* Configuration */ - eMSDP_CLIENT_ID, - eMSDP_CLIENT_VERSION, - eMSDP_PLUGIN_ID, - eMSDP_ANSI_COLORS, - eMSDP_XTERM_256_COLORS, - eMSDP_UTF_8, - eMSDP_SOUND, - eMSDP_MXP, + /* Configuration */ + eMSDP_CLIENT_ID, + eMSDP_CLIENT_VERSION, + eMSDP_PLUGIN_ID, + eMSDP_ANSI_COLORS, + eMSDP_XTERM_256_COLORS, + eMSDP_UTF_8, + eMSDP_SOUND, + eMSDP_MXP, - /* GUI variables */ - eMSDP_BUTTON_1, - eMSDP_BUTTON_2, - eMSDP_BUTTON_3, - eMSDP_BUTTON_4, - eMSDP_BUTTON_5, - eMSDP_GAUGE_1, - eMSDP_GAUGE_2, - eMSDP_GAUGE_3, - eMSDP_GAUGE_4, - eMSDP_GAUGE_5, + /* GUI variables */ + eMSDP_BUTTON_1, + eMSDP_BUTTON_2, + eMSDP_BUTTON_3, + eMSDP_BUTTON_4, + eMSDP_BUTTON_5, + eMSDP_GAUGE_1, + eMSDP_GAUGE_2, + eMSDP_GAUGE_3, + eMSDP_GAUGE_4, + eMSDP_GAUGE_5, - eMSDP_MAX /* This must always be last */ + eMSDP_MAX /* This must always be last */ } variable_t; -typedef struct -{ - variable_t Variable; /* The enum type of this variable */ - const char *pName; /* The string name of this variable */ - bool_t bString; /* Is this variable a string or a number? */ - bool_t bConfigurable; /* Can it be configured by the client? */ - bool_t bWriteOnce; /* Can only set this variable once */ - bool_t bGUI; /* It's a special GUI configuration variable */ - int Min; /* The minimum valid value or string length */ - int Max; /* The maximum valid value or string length */ - int Default; /* The default value for a number */ - const char *pDefault; /* The default value for a string */ +typedef struct { + variable_t Variable; /* The enum type of this variable */ + const char *pName; /* The string name of this variable */ + bool_t bString; /* Is this variable a string or a number? */ + bool_t bConfigurable; /* Can it be configured by the client? */ + bool_t bWriteOnce; /* Can only set this variable once */ + bool_t bGUI; /* It's a special GUI configuration variable */ + int Min; /* The minimum valid value or string length */ + int Max; /* The maximum valid value or string length */ + int Default; /* The default value for a number */ + const char *pDefault; /* The default value for a string */ } variable_name_t; -typedef struct -{ - bool_t bReport; /* Is this variable being reported? */ - bool_t bDirty; /* Does this variable need to be sent again? */ - int ValueInt; /* The numeric value of the variable */ - char *pValueString; /* The string value of the variable */ +typedef struct { + bool_t bReport; /* Is this variable being reported? */ + bool_t bDirty; /* Does this variable need to be sent again? */ + int ValueInt; /* The numeric value of the variable */ + char *pValueString; /* The string value of the variable */ } MSDP_t; -typedef struct -{ - const char *pName; /* The name of the MSSP variable */ - const char *pValue; /* The value of the MSSP variable */ - const char *(*pFunction)(void); /* Optional function to return the value */ +typedef struct { + const char *pName; /* The name of the MSSP variable */ + const char *pValue; /* The value of the MSSP variable */ + const char *(*pFunction)(void); /* Optional function to return the value */ } MSSP_t; -typedef struct -{ - int WriteOOB; /* Used internally to indicate OOB data */ - bool_t bIACMode; /* Current mode - deals with broken packets */ - bool_t bNegotiated; /* Indicates client successfully negotiated */ - bool_t bBlockMXP; /* Used internally based on MXP version */ - bool_t bTTYPE; /* The client supports TTYPE */ - bool_t bNAWS; /* The client supports NAWS */ - bool_t bCHARSET; /* The client supports CHARSET */ - bool_t bMSDP; /* The client supports MSDP */ - bool_t bATCP; /* The client supports ATCP */ - bool_t bMSP; /* The client supports MSP */ - bool_t bMXP; /* The client supports MXP */ - bool_t bMCCP; /* The client supports MCCP */ - support_t b256Support; /* The client supports XTerm 256 colors */ - int ScreenWidth; /* The client's screen width */ - int ScreenHeight; /* The client's screen height */ - char *pMXPVersion; /* The version of MXP supported */ - char *pLastTTYPE; /* Used for the cyclic TTYPE check */ - MSDP_t **pVariables; /* The MSDP variables */ +typedef struct { + int WriteOOB; /* Used internally to indicate OOB data */ + bool_t bIACMode; /* Current mode - deals with broken packets */ + bool_t bNegotiated; /* Indicates client successfully negotiated */ + bool_t bBlockMXP; /* Used internally based on MXP version */ + bool_t bTTYPE; /* The client supports TTYPE */ + bool_t bNAWS; /* The client supports NAWS */ + bool_t bCHARSET; /* The client supports CHARSET */ + bool_t bMSDP; /* The client supports MSDP */ + bool_t bATCP; /* The client supports ATCP */ + bool_t bMSP; /* The client supports MSP */ + bool_t bMXP; /* The client supports MXP */ + bool_t bMCCP; /* The client supports MCCP */ + support_t b256Support; /* The client supports XTerm 256 colors */ + int ScreenWidth; /* The client's screen width */ + int ScreenHeight; /* The client's screen height */ + char *pMXPVersion; /* The version of MXP supported */ + char *pLastTTYPE; /* Used for the cyclic TTYPE check */ + MSDP_t **pVariables; /* The MSDP variables */ } protocol_t; /****************************************************************************** @@ -222,55 +215,55 @@ typedef struct /* Function: ProtocolCreate * - * Creates, initialises and returns a structure containing protocol data for a + * Creates, initialises and returns a structure containing protocol data for a * single user. This should be called when the descriptor is initialised. */ protocol_t *ProtocolCreate( void ); /* Function: ProtocolDestroy * - * Frees the memory allocated by the specified structure. This should be + * Frees the memory allocated by the specified structure. This should be * called just before a descriptor is freed. */ void ProtocolDestroy( protocol_t *apProtocol ); /* Function: ProtocolNegotiate * - * Negatiates with the client to see which protocols the user supports, and - * stores the results in the user's protocol structure. Call this when you - * wish to perform negotiation (but only call it once). It is usually called - * either immediately after the user has connected, or just after they have + * Negatiates with the client to see which protocols the user supports, and + * stores the results in the user's protocol structure. Call this when you + * wish to perform negotiation (but only call it once). It is usually called + * either immediately after the user has connected, or just after they have * entered the game. */ void ProtocolNegotiate( descriptor_t *apDescriptor ); /* Function: ProtocolInput * - * Extracts any negotiation sequences from the input buffer, and passes back - * whatever is left for the mud to parse normally. Call this after data has + * Extracts any negotiation sequences from the input buffer, and passes back + * whatever is left for the mud to parse normally. Call this after data has * been read into the input buffer, before it is used for anything else. */ - + /* MUD Primary Colours */ extern const char * RGBone; extern const char * RGBtwo; -extern const char * RGBthree; - +extern const char * RGBthree; + ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char *apOut ); /* Function: ProtocolOutput * - * This function takes a string, applies colour codes to it, and returns the + * This function takes a string, applies colour codes to it, and returns the * result. It should be called just before writing to the output buffer. - * - * The special character used to indicate the start of a colour sequence is - * '\t' (i.e., a tab, or ASCII character 9). This makes it easy to include - * in help files (as you can literally press the tab key) as well as strings - * (where you can use \t instead). However players can't send tabs (on most + * + * The special character used to indicate the start of a colour sequence is + * '\t' (i.e., a tab, or ASCII character 9). This makes it easy to include + * in help files (as you can literally press the tab key) as well as strings + * (where you can use \t instead). However players can't send tabs (on most * muds at least), so this stops them from sending colour codes to each other. - * + * * The predefined colours are: - * + * * n: no colour (switches colour off) * r: dark red R: bright red * g: dark green G: bright green @@ -280,41 +273,41 @@ ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char * c: dark cyan C: bright cyan * w: dark white W: bright white * o: dark orange O: bright orange - * - * So for example "This is \tOorange\tn." will colour the word "orange". You + * + * So for example "This is \tOorange\tn." will colour the word "orange". You * can add more colours yourself just by updating the switch statement. - * - * It's also possible to explicitly specify an RGB value, by including the four + * + * It's also possible to explicitly specify an RGB value, by including the four * character colour sequence (as used by ColourRGB) within square brackets, eg: - * + * * This is a \t[F010]very dark green foreground\tn. - * + * * The square brackets can also be used to send unicode characters, like this: - * + * * Boat: \t[U9973/B] * Rook: \t[U9814/C] - * - * For example you might use 'B' to represent a boat on your ASCII map, or a 'C' - * to represent a castle - but players with UTF-8 support would actually see the + * + * For example you might use 'B' to represent a boat on your ASCII map, or a 'C' + * to represent a castle - but players with UTF-8 support would actually see the * appropriate unicode characters for a boat or a rook (the chess playing piece). - * - * The exact syntax is '\t' (tab), '[', 'U' (indicating unicode), then the decimal - * number of the unicode character (see http://www.unicode.org/charts), then '/' - * followed by the ASCII character/s that should be used if the client doesn't - * support UTF-8. The ASCII sequence can be up to 7 characters in length, but in - * most cases you'll only want it to be one or two characters (so that it has the + * + * The exact syntax is '\t' (tab), '[', 'U' (indicating unicode), then the decimal + * number of the unicode character (see http://www.unicode.org/charts), then '/' + * followed by the ASCII character/s that should be used if the client doesn't + * support UTF-8. The ASCII sequence can be up to 7 characters in length, but in + * most cases you'll only want it to be one or two characters (so that it has the * same alignment as the unicode character). - * - * Finally, this function also allows you to embed MXP tags. The easiest and + * + * Finally, this function also allows you to embed MXP tags. The easiest and * safest way to do this is via the ( and ) bracket options: - * + * * From here, you can walk \t(north\t). - * + * * However it's also possible to include more explicit MSP tags, like this: - * + * * The baker offers to sell you a \tpie\t. - * - * Note that the MXP tags will automatically be removed if the user doesn't + * + * Note that the MXP tags will automatically be removed if the user doesn't * support MXP, but it's very important you remember to close the tags. */ const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, int *apLength ); @@ -325,24 +318,24 @@ const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, int /* Function: CopyoverGet * - * Returns the protocol values stored as a short string. If your mud uses - * copyover, you should call this for each player and insert it after their + * Returns the protocol values stored as a short string. If your mud uses + * copyover, you should call this for each player and insert it after their * name in the temporary text file. */ const char *CopyoverGet( descriptor_t *apDescriptor ); /* Function: CopyoverSet * - * Call this function for each player after a copyover, passing in the string - * you added to the temporary text file. This will restore their protocol + * Call this function for each player after a copyover, passing in the string + * you added to the temporary text file. This will restore their protocol * settings, and automatically renegotiate MSDP/ATCP. - * - * Note that the client doesn't recognise a copyover, and therefore refuses to - * renegotiate certain telnet options (to avoid loops), so they really need to - * be saved. However MSDP/ATCP is handled through scripts, and we don't want + * + * Note that the client doesn't recognise a copyover, and therefore refuses to + * renegotiate certain telnet options (to avoid loops), so they really need to + * be saved. However MSDP/ATCP is handled through scripts, and we don't want * to have to save all of the REPORT variables, so it's easier to renegotiate. - * - * Client name and version are not saved. It is recommended you save these in + * + * Client name and version are not saved. It is recommended you save these in * the player file, as then you can grep to collect client usage stats. */ void CopyoverSet( descriptor_t *apDescriptor, const char *apData ); @@ -353,33 +346,33 @@ void CopyoverSet( descriptor_t *apDescriptor, const char *apData ); /* Function: MSDPUpdate * - * Call this regularly (I'd suggest at least once per second) to flush every - * dirty MSDP variable that has been requested by the client via REPORT. This + * Call this regularly (I'd suggest at least once per second) to flush every + * dirty MSDP variable that has been requested by the client via REPORT. This * will automatically use ATCP instead if MSDP is not supported by the client. */ void MSDPUpdate( descriptor_t *apDescriptor ); /* Function: MSDPFlush * - * Works like MSDPUpdate(), except only flushes a specific variable. The + * Works like MSDPUpdate(), except only flushes a specific variable. The * variable will only actually be sent if it's both reported and dirty. - * - * Call this function after setting a variable if you want it to be reported + * + * Call this function after setting a variable if you want it to be reported * immediately, instead of on the next update. */ void MSDPFlush( descriptor_t *apDescriptor, variable_t aMSDP ); /* Function: MSDPSend * - * Send the specified MSDP variable to the player. You shouldn't ever really - * need to do this manually, except perhaps when debugging something. This + * Send the specified MSDP variable to the player. You shouldn't ever really + * need to do this manually, except perhaps when debugging something. This * will automatically use ATCP instead if MSDP is not supported by the client. */ void MSDPSend( descriptor_t *apDescriptor, variable_t aMSDP ); /* Function: MSDPSendPair * - * Send the specified strings to the user as an MSDP variable/value pair. This + * Send the specified strings to the user as an MSDP variable/value pair. This * will automatically use ATCP instead if MSDP is not supported by the client. */ void MSDPSendPair( descriptor_t *apDescriptor, const char *apVariable, const char *apValue ); @@ -394,20 +387,20 @@ void MSDPSendList( descriptor_t *apDescriptor, const char *apVariable, const cha /* Function: MSDPSetNumber * - * Call this whenever an MSDP integer variable has changed. The easiest - * approach is to send every MSDP variable within an update function (and - * this is what the snippet does by default), but if the variable is only + * Call this whenever an MSDP integer variable has changed. The easiest + * approach is to send every MSDP variable within an update function (and + * this is what the snippet does by default), but if the variable is only * set in one place you can just move its MDSPSend() call to there. - * + * * You can also this function for bools, chars, enums, short ints, etc. */ void MSDPSetNumber( descriptor_t *apDescriptor, variable_t aMSDP, int aValue ); /* Function: MSDPSetString * - * Call this whenever an MSDP string variable has changed. The easiest - * approach is to send every MSDP variable within an update function (and - * this is what the snippet does by default), but if the variable is only + * Call this whenever an MSDP string variable has changed. The easiest + * approach is to send every MSDP variable within an update function (and + * this is what the snippet does by default), but if the variable is only * set in one place you can just move its MDSPSend() call to there. */ void MSDPSetString( descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue ); @@ -440,7 +433,7 @@ void MSDPSetArray( descriptor_t *apDescriptor, variable_t aMSDP, const char *apV /* Function: MSSPSetPlayers * - * Stores the current number of players. The first time it's called, it also + * Stores the current number of players. The first time it's called, it also * stores the uptime. */ void MSSPSetPlayers( int aPlayers ); @@ -451,17 +444,17 @@ void MSSPSetPlayers( int aPlayers ); /* Function: MXPCreateTag * - * Puts the specified tag into a secure line, if MXP is supported. If the user - * doesn't support MXP they will see the string unchanged, meaning they will - * see the tags or whatever. You should therefore check for support and - * provide a different sequence for other users, or better yet just embed MXP + * Puts the specified tag into a secure line, if MXP is supported. If the user + * doesn't support MXP they will see the string unchanged, meaning they will + * see the tags or whatever. You should therefore check for support and + * provide a different sequence for other users, or better yet just embed MXP * tags for the ProtocolOutput() function. */ const char *MXPCreateTag( descriptor_t *apDescriptor, const char *apTag ); /* Function: MXPSendTag * - * This works like MXPCreateTag, but instead of returning the string it sends + * This works like MXPCreateTag, but instead of returning the string it sends * it directly to the user. This is mainly useful for the tag. */ void MXPSendTag( descriptor_t *apDescriptor, const char *apTag ); @@ -472,8 +465,8 @@ void MXPSendTag( descriptor_t *apDescriptor, const char *apTag ); /* Function: SoundSend * - * Sends the specified sound trigger to the player, using MSDP or ATCP if - * supported, MSP if not. The trigger string itself is a relative path and + * Sends the specified sound trigger to the player, using MSDP or ATCP if + * supported, MSP if not. The trigger string itself is a relative path and * filename, eg: SoundSend( pDesc, "monster/growl.wav" ); */ void SoundSend( descriptor_t *apDescriptor, const char *apTrigger ); @@ -484,17 +477,17 @@ void SoundSend( descriptor_t *apDescriptor, const char *apTrigger ); /* Function: ColourRGB * - * Returns a colour as an escape code, based on the RGB value provided. The - * string must be four characters, where the first is either 'f' for foreground - * or 'b' for background (case insensitive), and the other three characters are + * Returns a colour as an escape code, based on the RGB value provided. The + * string must be four characters, where the first is either 'f' for foreground + * or 'b' for background (case insensitive), and the other three characters are * numeric digits in the range 0 to 5, representing red, green and blue. - * - * For example "F500" returns a red foreground, "B530" an orange background, + * + * For example "F500" returns a red foreground, "B530" an orange background, * and so on. An invalid colour will clear whatever you've set previously. - * - * If the user doesn't support XTerm 256 colours, this function will return the + * + * If the user doesn't support XTerm 256 colours, this function will return the * best-fit ANSI colour instead. - * + * * If you wish to embed colours in strings, use ProtocolOutput(). */ const char *ColourRGB( descriptor_t *apDescriptor, const char *apRGB ); @@ -511,7 +504,7 @@ char *UnicodeGet( int aValue ); /* Function: UnicodeAdd * - * Adds the UTF-8 sequence for the specified unicode value onto the end of the + * Adds the UTF-8 sequence for the specified unicode value onto the end of the * string, without adding a NUL character at the end. */ void UnicodeAdd( char **apString, int aValue ); diff --git a/src/quest.c b/src/quest.c index 7820b93..ebf417d 100644 --- a/src/quest.c +++ b/src/quest.c @@ -26,18 +26,18 @@ * Exported global variables *--------------------------------------------------------------------------*/ const char *quest_types[] = { - "Object", - "Room", - "Find mob", - "Kill mob", - "Save mob", - "Return object", - "Clear room", - "\n" + "Object", + "Room", + "Find mob", + "Kill mob", + "Save mob", + "Return object", + "Clear room", + "\n" }; const char *aq_flags[] = { - "REPEATABLE", - "\n" + "REPEATABLE", + "\n" }; @@ -47,13 +47,14 @@ const char *aq_flags[] = { static int cmd_tell; static const char *quest_cmd[] = { - "list", "history", "join", "leave", "progress", "status", "\n"}; + "list", "history", "join", "leave", "progress", "status", "\n" +}; static const char *quest_mort_usage = - "Usage: quest list | history | progress | join | leave"; + "Usage: quest list | history | progress | join | leave"; static const char *quest_imm_usage = - "Usage: quest list | history | progress | join | leave | status "; + "Usage: quest list | history | progress | join | leave | status "; /*--------------------------------------------------------------------------*/ /* Utility Functions */ @@ -61,34 +62,34 @@ static const char *quest_imm_usage = qst_rnum real_quest(qst_vnum vnum) { - int rnum; + int rnum; - for (rnum = 0; rnum < total_quests; rnum++) - if (QST_NUM(rnum) == vnum) - return(rnum); - return(NOTHING); + for (rnum = 0; rnum < total_quests; rnum++) + if (QST_NUM(rnum) == vnum) + return(rnum); + return(NOTHING); } int is_complete(struct char_data *ch, qst_vnum vnum) { - int i; + int i; - for (i = 0; i < GET_NUM_QUESTS(ch); i++) - if (ch->player_specials->saved.completed_quests[i] == vnum) - return TRUE; - return FALSE; + for (i = 0; i < GET_NUM_QUESTS(ch); i++) + if (ch->player_specials->saved.completed_quests[i] == vnum) + return TRUE; + return FALSE; } qst_vnum find_quest_by_qmnum(struct char_data *ch, mob_vnum qm, int num) { - qst_rnum rnum; - int found=0; - for (rnum = 0; rnum < total_quests; rnum++) { - if (qm == QST_MASTER(rnum)) - if (++found == num) - return (QST_NUM(rnum)); - } - return NOTHING; + qst_rnum rnum; + int found=0; + for (rnum = 0; rnum < total_quests; rnum++) { + if (qm == QST_MASTER(rnum)) + if (++found == num) + return (QST_NUM(rnum)); + } + return NOTHING; } /*--------------------------------------------------------------------------*/ @@ -97,138 +98,138 @@ qst_vnum find_quest_by_qmnum(struct char_data *ch, mob_vnum qm, int num) void destroy_quests(void) { - qst_rnum rnum = 0; + qst_rnum rnum = 0; + + if (!aquest_table) + return; + + for (rnum = 0; rnum < total_quests; rnum++) { + free_quest_strings(&aquest_table[rnum]); + } + free(aquest_table); + aquest_table = NULL; + total_quests = 0; - if (!aquest_table) return; - - for (rnum = 0; rnum < total_quests; rnum++){ - free_quest_strings(&aquest_table[rnum]); - } - free(aquest_table); - aquest_table = NULL; - total_quests = 0; - - return; } int count_quests(qst_vnum low, qst_vnum high) { - int i, j; + int i, j; - if (!aquest_table) - return 0; + if (!aquest_table) + return 0; - for (i = j = 0; i < total_quests; i++) - if (QST_NUM(i) >= low && QST_NUM(i) <= high) - j++; + for (i = j = 0; i < total_quests; i++) + if (QST_NUM(i) >= low && QST_NUM(i) <= high) + j++; - return j; + return j; } void parse_quest(FILE *quest_f, int nr) { - static char line[256]; - static int i = 0, j; - int retval = 0, t[7]; - char f1[128], buf2[MAX_STRING_LENGTH]; - aquest_table[i].vnum = nr; - aquest_table[i].qm = NOBODY; - aquest_table[i].name = NULL; - aquest_table[i].desc = NULL; - aquest_table[i].info = NULL; - aquest_table[i].done = NULL; - aquest_table[i].quit = NULL; - aquest_table[i].flags = 0; - aquest_table[i].type = -1; - aquest_table[i].target = -1; - aquest_table[i].prereq = NOTHING; - for (j = 0; j < 7; j++) - aquest_table[i].value[j] = 0; - aquest_table[i].prev_quest = NOTHING; - aquest_table[i].next_quest = NOTHING; - aquest_table[i].func = NULL; + static char line[256]; + static int i = 0, j; + int retval = 0, t[7]; + char f1[128], buf2[MAX_STRING_LENGTH]; + aquest_table[i].vnum = nr; + aquest_table[i].qm = NOBODY; + aquest_table[i].name = NULL; + aquest_table[i].desc = NULL; + aquest_table[i].info = NULL; + aquest_table[i].done = NULL; + aquest_table[i].quit = NULL; + aquest_table[i].flags = 0; + aquest_table[i].type = -1; + aquest_table[i].target = -1; + aquest_table[i].prereq = NOTHING; + for (j = 0; j < 7; j++) + aquest_table[i].value[j] = 0; + aquest_table[i].prev_quest = NOTHING; + aquest_table[i].next_quest = NOTHING; + aquest_table[i].func = NULL; - aquest_table[i].gold_reward = 0; - aquest_table[i].exp_reward = 0; - aquest_table[i].obj_reward = NOTHING; + aquest_table[i].gold_reward = 0; + aquest_table[i].exp_reward = 0; + aquest_table[i].obj_reward = NOTHING; - /* begin to parse the data */ - aquest_table[i].name = fread_string(quest_f, buf2); - aquest_table[i].desc = fread_string(quest_f, buf2); - aquest_table[i].info = fread_string(quest_f, buf2); - aquest_table[i].done = fread_string(quest_f, buf2); - aquest_table[i].quit = fread_string(quest_f, buf2); - if (!get_line(quest_f, line) || - (retval = sscanf(line, " %d %d %s %d %d %d %d", - t, t+1, f1, t+2, t+3, t + 4, t + 5)) != 7) { - log("Format error in numeric line (expected 7, got %d), %s\n", - retval, line); - exit(1); - } - aquest_table[i].type = t[0]; - aquest_table[i].qm = (real_mobile(t[1]) == NOBODY) ? NOBODY : t[1]; - aquest_table[i].flags = asciiflag_conv(f1); - aquest_table[i].target = (t[2] == -1) ? NOTHING : t[2]; - aquest_table[i].prev_quest = (t[3] == -1) ? NOTHING : t[3]; - aquest_table[i].next_quest = (t[4] == -1) ? NOTHING : t[4]; - aquest_table[i].prereq = (t[5] == -1) ? NOTHING : t[5]; - if (!get_line(quest_f, line) || - (retval = sscanf(line, " %d %d %d %d %d %d %d", - t, t+1, t+2, t+3, t+4, t + 5, t + 6)) != 7) { - log("Format error in numeric line (expected 7, got %d), %s\n", - retval, line); - exit(1); - } - for (j = 0; j < 7; j++) - aquest_table[i].value[j] = t[j]; - - if (!get_line(quest_f, line) || - (retval = sscanf(line, " %d %d %d", - t, t+1, t+2)) != 3) { - log("Format error in numeric (rewards) line (expected 3, got %d), %s\n", - retval, line); - exit(1); - } - - aquest_table[i].gold_reward = t[0]; - aquest_table[i].exp_reward = t[1]; - aquest_table[i].obj_reward = (t[2] == -1) ? NOTHING : t[2]; - - for (;;) { - if (!get_line(quest_f, line)) { - log("Format error in %s\n", line); - exit(1); + /* begin to parse the data */ + aquest_table[i].name = fread_string(quest_f, buf2); + aquest_table[i].desc = fread_string(quest_f, buf2); + aquest_table[i].info = fread_string(quest_f, buf2); + aquest_table[i].done = fread_string(quest_f, buf2); + aquest_table[i].quit = fread_string(quest_f, buf2); + if (!get_line(quest_f, line) || + (retval = sscanf(line, " %d %d %s %d %d %d %d", + t, t+1, f1, t+2, t+3, t + 4, t + 5)) != 7) { + log("Format error in numeric line (expected 7, got %d), %s\n", + retval, line); + exit(1); } - switch(*line) { - case 'S': - total_quests = ++i; - return; + aquest_table[i].type = t[0]; + aquest_table[i].qm = (real_mobile(t[1]) == NOBODY) ? NOBODY : t[1]; + aquest_table[i].flags = asciiflag_conv(f1); + aquest_table[i].target = (t[2] == -1) ? NOTHING : t[2]; + aquest_table[i].prev_quest = (t[3] == -1) ? NOTHING : t[3]; + aquest_table[i].next_quest = (t[4] == -1) ? NOTHING : t[4]; + aquest_table[i].prereq = (t[5] == -1) ? NOTHING : t[5]; + if (!get_line(quest_f, line) || + (retval = sscanf(line, " %d %d %d %d %d %d %d", + t, t+1, t+2, t+3, t+4, t + 5, t + 6)) != 7) { + log("Format error in numeric line (expected 7, got %d), %s\n", + retval, line); + exit(1); + } + for (j = 0; j < 7; j++) + aquest_table[i].value[j] = t[j]; + + if (!get_line(quest_f, line) || + (retval = sscanf(line, " %d %d %d", + t, t+1, t+2)) != 3) { + log("Format error in numeric (rewards) line (expected 3, got %d), %s\n", + retval, line); + exit(1); + } + + aquest_table[i].gold_reward = t[0]; + aquest_table[i].exp_reward = t[1]; + aquest_table[i].obj_reward = (t[2] == -1) ? NOTHING : t[2]; + + for (;;) { + if (!get_line(quest_f, line)) { + log("Format error in %s\n", line); + exit(1); + } + switch(*line) { + case 'S': + total_quests = ++i; + return; + } } - } } /* parse_quest */ void assign_the_quests(void) { - qst_rnum rnum; - mob_rnum mrnum; + qst_rnum rnum; + mob_rnum mrnum; - cmd_tell = find_command("tell"); + cmd_tell = find_command("tell"); - for (rnum = 0; rnum < total_quests; rnum ++) { - if (QST_MASTER(rnum) == NOBODY) { - log("SYSERR: Quest #%d has no questmaster specified.", QST_NUM(rnum)); - continue; + for (rnum = 0; rnum < total_quests; rnum ++) { + if (QST_MASTER(rnum) == NOBODY) { + log("SYSERR: Quest #%d has no questmaster specified.", QST_NUM(rnum)); + continue; + } + if ((mrnum = real_mobile(QST_MASTER(rnum))) == NOBODY) { + log("SYSERR: Quest #%d has an invalid questmaster.", QST_NUM(rnum)); + continue; + } + if (mob_index[(mrnum)].func && + mob_index[(mrnum)].func != questmaster) + QST_FUNC(rnum) = mob_index[(mrnum)].func; + mob_index[(mrnum)].func = questmaster; } - if ((mrnum = real_mobile(QST_MASTER(rnum))) == NOBODY) { - log("SYSERR: Quest #%d has an invalid questmaster.", QST_NUM(rnum)); - continue; - } - if (mob_index[(mrnum)].func && - mob_index[(mrnum)].func != questmaster) - QST_FUNC(rnum) = mob_index[(mrnum)].func; - mob_index[(mrnum)].func = questmaster; - } } /*--------------------------------------------------------------------------*/ @@ -236,214 +237,214 @@ void assign_the_quests(void) /*--------------------------------------------------------------------------*/ void set_quest(struct char_data *ch, qst_rnum rnum) { - GET_QUEST(ch) = QST_NUM(rnum); - GET_QUEST_TIME(ch) = QST_TIME(rnum); - GET_QUEST_COUNTER(ch) = QST_QUANTITY(rnum); - SET_BIT_AR(PRF_FLAGS(ch), PRF_QUEST); - return; + GET_QUEST(ch) = QST_NUM(rnum); + GET_QUEST_TIME(ch) = QST_TIME(rnum); + GET_QUEST_COUNTER(ch) = QST_QUANTITY(rnum); + SET_BIT_AR(PRF_FLAGS(ch), PRF_QUEST); + return; } void clear_quest(struct char_data *ch) { - GET_QUEST(ch) = NOTHING; - GET_QUEST_TIME(ch) = -1; - GET_QUEST_COUNTER(ch) = 0; - REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_QUEST); - return; + GET_QUEST(ch) = NOTHING; + GET_QUEST_TIME(ch) = -1; + GET_QUEST_COUNTER(ch) = 0; + REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_QUEST); + return; } void add_completed_quest(struct char_data *ch, qst_vnum vnum) { - qst_vnum *temp; - int i; + qst_vnum *temp; + int i; - CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch) +1); - for (i=0; i < GET_NUM_QUESTS(ch); i++) - temp[i] = ch->player_specials->saved.completed_quests[i]; + CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch) +1); + for (i=0; i < GET_NUM_QUESTS(ch); i++) + temp[i] = ch->player_specials->saved.completed_quests[i]; - temp[GET_NUM_QUESTS(ch)] = vnum; - GET_NUM_QUESTS(ch)++; + temp[GET_NUM_QUESTS(ch)] = vnum; + GET_NUM_QUESTS(ch)++; - if (ch->player_specials->saved.completed_quests) - free(ch->player_specials->saved.completed_quests); - ch->player_specials->saved.completed_quests = temp; + if (ch->player_specials->saved.completed_quests) + free(ch->player_specials->saved.completed_quests); + ch->player_specials->saved.completed_quests = temp; } void remove_completed_quest(struct char_data *ch, qst_vnum vnum) { - qst_vnum *temp; - int i, j = 0; + qst_vnum *temp; + int i, j = 0; - CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch)); - for (i = 0; i < GET_NUM_QUESTS(ch); i++) - if (ch->player_specials->saved.completed_quests[i] != vnum) - temp[j++] = ch->player_specials->saved.completed_quests[i]; + CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch)); + for (i = 0; i < GET_NUM_QUESTS(ch); i++) + if (ch->player_specials->saved.completed_quests[i] != vnum) + temp[j++] = ch->player_specials->saved.completed_quests[i]; - GET_NUM_QUESTS(ch)--; + GET_NUM_QUESTS(ch)--; - if (ch->player_specials->saved.completed_quests) - free(ch->player_specials->saved.completed_quests); - ch->player_specials->saved.completed_quests = temp; + if (ch->player_specials->saved.completed_quests) + free(ch->player_specials->saved.completed_quests); + ch->player_specials->saved.completed_quests = temp; } void generic_complete_quest(struct char_data *ch) { - qst_rnum rnum; - qst_vnum vnum = GET_QUEST(ch); - struct obj_data *new_obj; - int happy_qp, happy_gold, happy_exp; + qst_rnum rnum; + qst_vnum vnum = GET_QUEST(ch); + struct obj_data *new_obj; + int happy_qp, happy_gold, happy_exp; - if (--GET_QUEST_COUNTER(ch) <= 0) { - rnum = real_quest(vnum); - if (IS_HAPPYHOUR && IS_HAPPYQP) { - happy_qp = (int)(QST_POINTS(rnum) * (((float)(100+HAPPY_QP))/(float)100)); - happy_qp = MAX(happy_qp, 0); - GET_QUESTPOINTS(ch) += happy_qp; - send_to_char(ch, - "%s\r\nYou have been awarded %d quest points for your service.\r\n", - QST_DONE(rnum), happy_qp); - } else { - GET_QUESTPOINTS(ch) += QST_POINTS(rnum); - send_to_char(ch, - "%s\r\nYou have been awarded %d quest points for your service.\r\n", - QST_DONE(rnum), QST_POINTS(rnum)); - } - if (QST_GOLD(rnum)) { - if ((IS_HAPPYHOUR) && (IS_HAPPYGOLD)) { - happy_gold = (int)(QST_GOLD(rnum) * (((float)(100+HAPPY_GOLD))/(float)100)); - happy_gold = MAX(happy_gold, 0); - increase_gold(ch, happy_gold); - send_to_char(ch, - "You have been awarded %d gold coins for your service.\r\n", - happy_gold); - } else { - increase_gold(ch, QST_GOLD(rnum)); - send_to_char(ch, - "You have been awarded %d gold coins for your service.\r\n", - QST_GOLD(rnum)); - } - } - if (QST_EXP(rnum)) { - gain_exp(ch, QST_EXP(rnum)); - if ((IS_HAPPYHOUR) && (IS_HAPPYEXP)) { - happy_exp = (int)(QST_EXP(rnum) * (((float)(100+HAPPY_EXP))/(float)100)); - happy_exp = MAX(happy_exp, 0); - send_to_char(ch, - "You have been awarded %d experience for your service.\r\n", - happy_exp); - } else { - send_to_char(ch, - "You have been awarded %d experience points for your service.\r\n", - QST_EXP(rnum)); - } - } - if (QST_OBJ(rnum) && QST_OBJ(rnum) != NOTHING) { - if (real_object(QST_OBJ(rnum)) != NOTHING) { - if ((new_obj = read_object((QST_OBJ(rnum)),VIRTUAL)) != NULL) { - obj_to_char(new_obj, ch); - send_to_char(ch, "You have been presented with %s%s for your service.\r\n", - GET_OBJ_SHORT(new_obj), CCNRM(ch, C_NRM)); + if (--GET_QUEST_COUNTER(ch) <= 0) { + rnum = real_quest(vnum); + if (IS_HAPPYHOUR && IS_HAPPYQP) { + happy_qp = (int)(QST_POINTS(rnum) * (((float)(100+HAPPY_QP))/(float)100)); + happy_qp = MAX(happy_qp, 0); + GET_QUESTPOINTS(ch) += happy_qp; + send_to_char(ch, + "%s\r\nYou have been awarded %d quest points for your service.\r\n", + QST_DONE(rnum), happy_qp); + } else { + GET_QUESTPOINTS(ch) += QST_POINTS(rnum); + send_to_char(ch, + "%s\r\nYou have been awarded %d quest points for your service.\r\n", + QST_DONE(rnum), QST_POINTS(rnum)); + } + if (QST_GOLD(rnum)) { + if ((IS_HAPPYHOUR) && (IS_HAPPYGOLD)) { + happy_gold = (int)(QST_GOLD(rnum) * (((float)(100+HAPPY_GOLD))/(float)100)); + happy_gold = MAX(happy_gold, 0); + increase_gold(ch, happy_gold); + send_to_char(ch, + "You have been awarded %d gold coins for your service.\r\n", + happy_gold); + } else { + increase_gold(ch, QST_GOLD(rnum)); + send_to_char(ch, + "You have been awarded %d gold coins for your service.\r\n", + QST_GOLD(rnum)); + } + } + if (QST_EXP(rnum)) { + gain_exp(ch, QST_EXP(rnum)); + if ((IS_HAPPYHOUR) && (IS_HAPPYEXP)) { + happy_exp = (int)(QST_EXP(rnum) * (((float)(100+HAPPY_EXP))/(float)100)); + happy_exp = MAX(happy_exp, 0); + send_to_char(ch, + "You have been awarded %d experience for your service.\r\n", + happy_exp); + } else { + send_to_char(ch, + "You have been awarded %d experience points for your service.\r\n", + QST_EXP(rnum)); + } + } + if (QST_OBJ(rnum) && QST_OBJ(rnum) != NOTHING) { + if (real_object(QST_OBJ(rnum)) != NOTHING) { + if ((new_obj = read_object((QST_OBJ(rnum)),VIRTUAL)) != NULL) { + obj_to_char(new_obj, ch); + send_to_char(ch, "You have been presented with %s%s for your service.\r\n", + GET_OBJ_SHORT(new_obj), CCNRM(ch, C_NRM)); + } + } + } + if (!IS_SET(QST_FLAGS(rnum), AQ_REPEATABLE)) + add_completed_quest(ch, vnum); + clear_quest(ch); + if ((real_quest(QST_NEXT(rnum)) != NOTHING) && + (QST_NEXT(rnum) != vnum) && + !is_complete(ch, QST_NEXT(rnum))) { + rnum = real_quest(QST_NEXT(rnum)); + set_quest(ch, rnum); + send_to_char(ch, + "The next stage of your quest awaits:\r\n%s", + QST_INFO(rnum)); } - } } - if (!IS_SET(QST_FLAGS(rnum), AQ_REPEATABLE)) - add_completed_quest(ch, vnum); - clear_quest(ch); - if ((real_quest(QST_NEXT(rnum)) != NOTHING) && - (QST_NEXT(rnum) != vnum) && - !is_complete(ch, QST_NEXT(rnum))) { - rnum = real_quest(QST_NEXT(rnum)); - set_quest(ch, rnum); - send_to_char(ch, - "The next stage of your quest awaits:\r\n%s", - QST_INFO(rnum)); - } - } - save_char(ch); + save_char(ch); } void autoquest_trigger_check(struct char_data *ch, struct char_data *vict, - struct obj_data *object, int type) + struct obj_data *object, int type) { - struct char_data *i; - qst_rnum rnum; - int found = TRUE; + struct char_data *i; + qst_rnum rnum; + int found = TRUE; - if (IS_NPC(ch)) - return; - if (GET_QUEST(ch) == NOTHING) /* No current quest, skip this */ - return; - if (GET_QUEST_TYPE(ch) != type) - return; - if ((rnum = real_quest(GET_QUEST(ch))) == NOTHING) - return; - switch (type) { + if (IS_NPC(ch)) + return; + if (GET_QUEST(ch) == NOTHING) /* No current quest, skip this */ + return; + if (GET_QUEST_TYPE(ch) != type) + return; + if ((rnum = real_quest(GET_QUEST(ch))) == NOTHING) + return; + switch (type) { case AQ_OBJ_FIND: - if (QST_TARGET(rnum) == GET_OBJ_VNUM(object)) - generic_complete_quest(ch); - break; + if (QST_TARGET(rnum) == GET_OBJ_VNUM(object)) + generic_complete_quest(ch); + break; case AQ_ROOM_FIND: - if (QST_TARGET(rnum) == world[IN_ROOM(ch)].number) - generic_complete_quest(ch); - break; + if (QST_TARGET(rnum) == world[IN_ROOM(ch)].number) + generic_complete_quest(ch); + break; case AQ_MOB_FIND: - for (i=world[IN_ROOM(ch)].people; i; i = i->next_in_room) - if (IS_NPC(i)) - if (QST_TARGET(rnum) == GET_MOB_VNUM(i)) - generic_complete_quest(ch); - break; + for (i=world[IN_ROOM(ch)].people; i; i = i->next_in_room) + if (IS_NPC(i)) + if (QST_TARGET(rnum) == GET_MOB_VNUM(i)) + generic_complete_quest(ch); + break; case AQ_MOB_KILL: - if (!IS_NPC(ch) && IS_NPC(vict) && (ch != vict)) - if (QST_TARGET(rnum) == GET_MOB_VNUM(vict)) - generic_complete_quest(ch); - break; + if (!IS_NPC(ch) && IS_NPC(vict) && (ch != vict)) + if (QST_TARGET(rnum) == GET_MOB_VNUM(vict)) + generic_complete_quest(ch); + break; case AQ_MOB_SAVE: - if (ch == vict) - found = FALSE; - for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room) - if (i && IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET)) - if ((GET_MOB_VNUM(i) != QST_TARGET(rnum)) && - !AFF_FLAGGED(i, AFF_CHARM)) - found = FALSE; - if (found) - generic_complete_quest(ch); - break; - case AQ_OBJ_RETURN: - if (IS_NPC(vict) && (GET_MOB_VNUM(vict) == QST_RETURNMOB(rnum))) - if (object && (GET_OBJ_VNUM(object) == QST_TARGET(rnum))) - generic_complete_quest(ch); - break; - case AQ_ROOM_CLEAR: - if (QST_TARGET(rnum) == world[IN_ROOM(ch)].number) { - for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room) - if (i && IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET)) + if (ch == vict) found = FALSE; + for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room) + if (i && IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET)) + if ((GET_MOB_VNUM(i) != QST_TARGET(rnum)) && + !AFF_FLAGGED(i, AFF_CHARM)) + found = FALSE; if (found) - generic_complete_quest(ch); - } - break; + generic_complete_quest(ch); + break; + case AQ_OBJ_RETURN: + if (IS_NPC(vict) && (GET_MOB_VNUM(vict) == QST_RETURNMOB(rnum))) + if (object && (GET_OBJ_VNUM(object) == QST_TARGET(rnum))) + generic_complete_quest(ch); + break; + case AQ_ROOM_CLEAR: + if (QST_TARGET(rnum) == world[IN_ROOM(ch)].number) { + for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room) + if (i && IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET)) + found = FALSE; + if (found) + generic_complete_quest(ch); + } + break; default: - log("SYSERR: Invalid quest type passed to autoquest_trigger_check"); - break; - } + log("SYSERR: Invalid quest type passed to autoquest_trigger_check"); + break; + } } void quest_timeout(struct char_data *ch) { - if ((GET_QUEST(ch) != NOTHING) && (GET_QUEST_TIME(ch) != -1)) { - clear_quest(ch); - send_to_char(ch, "You have run out of time to complete the quest.\r\n"); - } + if ((GET_QUEST(ch) != NOTHING) && (GET_QUEST_TIME(ch) != -1)) { + clear_quest(ch); + send_to_char(ch, "You have run out of time to complete the quest.\r\n"); + } } void check_timed_quests(void) { - struct char_data *ch; + struct char_data *ch; - for (ch = character_list; ch; ch = ch->next) - if (!IS_NPC(ch) && (GET_QUEST(ch) != NOTHING) && (GET_QUEST_TIME(ch) != -1)) - if (--GET_QUEST_TIME(ch) == 0) - quest_timeout(ch); + for (ch = character_list; ch; ch = ch->next) + if (!IS_NPC(ch) && (GET_QUEST(ch) != NOTHING) && (GET_QUEST_TIME(ch) != -1)) + if (--GET_QUEST_TIME(ch) == 0) + quest_timeout(ch); } /*--------------------------------------------------------------------------*/ @@ -452,298 +453,299 @@ void check_timed_quests(void) void list_quests(struct char_data *ch, zone_rnum zone, qst_vnum vmin, qst_vnum vmax) { - qst_rnum rnum; - qst_vnum bottom, top; - int counter = 0; + qst_rnum rnum; + qst_vnum bottom, top; + int counter = 0; - if (zone != NOWHERE) { - bottom = zone_table[zone].bot; - top = zone_table[zone].top; - } else { - bottom = vmin; - top = vmax; - } - /* Print the header for the quest listing. */ - send_to_char (ch, - "Index VNum Description Questmaster\r\n" - "----- ------- -------------------------------------------- -----------\r\n"); - for (rnum = 0; rnum < total_quests ; rnum++) - if (QST_NUM(rnum) >= bottom && QST_NUM(rnum) <= top) - send_to_char(ch, "\tg%4d\tn) [\tg%-5d\tn] \tc%-44.44s\tn \ty[%5d]\tn\r\n", - ++counter, QST_NUM(rnum), QST_NAME(rnum), - QST_MASTER(rnum) == NOBODY ? 0 : QST_MASTER(rnum)); - if (!counter) - send_to_char(ch, "None found.\r\n"); + if (zone != NOWHERE) { + bottom = zone_table[zone].bot; + top = zone_table[zone].top; + } else { + bottom = vmin; + top = vmax; + } + /* Print the header for the quest listing. */ + send_to_char (ch, + "Index VNum Description Questmaster\r\n" + "----- ------- -------------------------------------------- -----------\r\n"); + for (rnum = 0; rnum < total_quests ; rnum++) + if (QST_NUM(rnum) >= bottom && QST_NUM(rnum) <= top) + send_to_char(ch, "\tg%4d\tn) [\tg%-5d\tn] \tc%-44.44s\tn \ty[%5d]\tn\r\n", + ++counter, QST_NUM(rnum), QST_NAME(rnum), + QST_MASTER(rnum) == NOBODY ? 0 : QST_MASTER(rnum)); + if (!counter) + send_to_char(ch, "None found.\r\n"); } static void quest_hist(struct char_data *ch) { - int i = 0, counter = 0; - qst_rnum rnum = NOTHING; + int i = 0, counter = 0; + qst_rnum rnum = NOTHING; - send_to_char(ch, "Quests that you have completed:\r\n" - "Index Description Questmaster\r\n" - "----- ---------------------------------------------------- -----------\r\n"); - for (i = 0; i < GET_NUM_QUESTS(ch); i++) { - if ((rnum = real_quest(ch->player_specials->saved.completed_quests[i])) != NOTHING) - send_to_char(ch, "\tg%4d\tn) \tc%-52.52s\tn \ty%s\tn\r\n", - ++counter, QST_DESC(rnum), (real_mobile(QST_MASTER(rnum)) == NOBODY) ? "Unknown" : GET_NAME(&mob_proto[(real_mobile(QST_MASTER(rnum)))])); - else - send_to_char(ch, - "\tg%4d\tn) \tcUnknown Quest (it no longer exists)\tn\r\n", ++counter); - } - if (!counter) - send_to_char(ch, "You haven't completed any quests yet.\r\n"); + send_to_char(ch, "Quests that you have completed:\r\n" + "Index Description Questmaster\r\n" + "----- ---------------------------------------------------- -----------\r\n"); + for (i = 0; i < GET_NUM_QUESTS(ch); i++) { + if ((rnum = real_quest(ch->player_specials->saved.completed_quests[i])) != NOTHING) + send_to_char(ch, "\tg%4d\tn) \tc%-52.52s\tn \ty%s\tn\r\n", + ++counter, QST_DESC(rnum), (real_mobile(QST_MASTER(rnum)) == NOBODY) ? "Unknown" : GET_NAME(&mob_proto[(real_mobile( + QST_MASTER(rnum)))])); + else + send_to_char(ch, + "\tg%4d\tn) \tcUnknown Quest (it no longer exists)\tn\r\n", ++counter); + } + if (!counter) + send_to_char(ch, "You haven't completed any quests yet.\r\n"); } static void quest_join(struct char_data *ch, struct char_data *qm, char argument[MAX_INPUT_LENGTH]) { - qst_vnum vnum; - qst_rnum rnum; - char buf[MAX_INPUT_LENGTH]; + qst_vnum vnum; + qst_rnum rnum; + char buf[MAX_INPUT_LENGTH]; - if (!*argument) - snprintf(buf, sizeof(buf), - "%s What quest did you wish to join?", GET_NAME(ch)); - else if (GET_QUEST(ch) != NOTHING) - snprintf(buf, sizeof(buf), - "%s But you are already part of a quest!", GET_NAME(ch)); - else if((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING) - snprintf(buf, sizeof(buf), - "%s I don't know of such a quest!", GET_NAME(ch)); - else if ((rnum = real_quest(vnum)) == NOTHING) - snprintf(buf, sizeof(buf), - "%s I don't know of such a quest!", GET_NAME(ch)); - else if (GET_LEVEL(ch) < QST_MINLEVEL(rnum)) - snprintf(buf, sizeof(buf), - "%s You are not experienced enough for that quest!", GET_NAME(ch)); - else if (GET_LEVEL(ch) > QST_MAXLEVEL(rnum)) - snprintf(buf, sizeof(buf), - "%s You are too experienced for that quest!", GET_NAME(ch)); - else if (is_complete(ch, vnum)) - snprintf(buf, sizeof(buf), - "%s You have already completed that quest!", GET_NAME(ch)); - else if ((QST_PREV(rnum) != NOTHING) && !is_complete(ch, QST_PREV(rnum))) - snprintf(buf, sizeof(buf), - "%s That quest is not available to you yet!", GET_NAME(ch)); - else if ((QST_PREREQ(rnum) != NOTHING) && - (real_object(QST_PREREQ(rnum)) != NOTHING) && - (get_obj_in_list_num(real_object(QST_PREREQ(rnum)), - ch->carrying) == NULL)) - snprintf(buf, sizeof(buf), - "%s You need to have %s first!", GET_NAME(ch), - obj_proto[real_object(QST_PREREQ(rnum))].short_description); - else { - act("You join the quest.", TRUE, ch, NULL, NULL, TO_CHAR); - act("$n has joined a quest.", TRUE, ch, NULL, NULL, TO_ROOM); - snprintf(buf, sizeof(buf), - "%s Listen carefully to the instructions.", GET_NAME(ch)); + if (!*argument) + snprintf(buf, sizeof(buf), + "%s What quest did you wish to join?", GET_NAME(ch)); + else if (GET_QUEST(ch) != NOTHING) + snprintf(buf, sizeof(buf), + "%s But you are already part of a quest!", GET_NAME(ch)); + else if((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING) + snprintf(buf, sizeof(buf), + "%s I don't know of such a quest!", GET_NAME(ch)); + else if ((rnum = real_quest(vnum)) == NOTHING) + snprintf(buf, sizeof(buf), + "%s I don't know of such a quest!", GET_NAME(ch)); + else if (GET_LEVEL(ch) < QST_MINLEVEL(rnum)) + snprintf(buf, sizeof(buf), + "%s You are not experienced enough for that quest!", GET_NAME(ch)); + else if (GET_LEVEL(ch) > QST_MAXLEVEL(rnum)) + snprintf(buf, sizeof(buf), + "%s You are too experienced for that quest!", GET_NAME(ch)); + else if (is_complete(ch, vnum)) + snprintf(buf, sizeof(buf), + "%s You have already completed that quest!", GET_NAME(ch)); + else if ((QST_PREV(rnum) != NOTHING) && !is_complete(ch, QST_PREV(rnum))) + snprintf(buf, sizeof(buf), + "%s That quest is not available to you yet!", GET_NAME(ch)); + else if ((QST_PREREQ(rnum) != NOTHING) && + (real_object(QST_PREREQ(rnum)) != NOTHING) && + (get_obj_in_list_num(real_object(QST_PREREQ(rnum)), + ch->carrying) == NULL)) + snprintf(buf, sizeof(buf), + "%s You need to have %s first!", GET_NAME(ch), + obj_proto[real_object(QST_PREREQ(rnum))].short_description); + else { + act("You join the quest.", TRUE, ch, NULL, NULL, TO_CHAR); + act("$n has joined a quest.", TRUE, ch, NULL, NULL, TO_ROOM); + snprintf(buf, sizeof(buf), + "%s Listen carefully to the instructions.", GET_NAME(ch)); + do_tell(qm, buf, cmd_tell, 0); + set_quest(ch, rnum); + send_to_char(ch, "%s", QST_INFO(rnum)); + if (QST_TIME(rnum) != -1) + snprintf(buf, sizeof(buf), + "%s You have a time limit of %d turn%s to complete the quest.", + GET_NAME(ch), QST_TIME(rnum), QST_TIME(rnum) == 1 ? "" : "s"); + else + snprintf(buf, sizeof(buf), + "%s You can take however long you want to complete the quest.", + GET_NAME(ch)); + } do_tell(qm, buf, cmd_tell, 0); - set_quest(ch, rnum); - send_to_char(ch, "%s", QST_INFO(rnum)); - if (QST_TIME(rnum) != -1) - snprintf(buf, sizeof(buf), - "%s You have a time limit of %d turn%s to complete the quest.", - GET_NAME(ch), QST_TIME(rnum), QST_TIME(rnum) == 1 ? "" : "s"); - else - snprintf(buf, sizeof(buf), - "%s You can take however long you want to complete the quest.", - GET_NAME(ch)); - } - do_tell(qm, buf, cmd_tell, 0); - save_char(ch); + save_char(ch); } void quest_list(struct char_data *ch, struct char_data *qm, char argument[MAX_INPUT_LENGTH]) { - qst_vnum vnum; - qst_rnum rnum; + qst_vnum vnum; + qst_rnum rnum; - if ((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING) - send_to_char(ch, "That is not a valid quest!\r\n"); - else if ((rnum = real_quest(vnum)) == NOTHING) - send_to_char(ch, "That is not a valid quest!\r\n"); - else if (QST_INFO(rnum)) { - send_to_char(ch,"Complete Details on Quest %d \tc%s\tn:\r\n%s", - vnum, - QST_DESC(rnum), - QST_INFO(rnum)); - if (QST_PREV(rnum) != NOTHING) - send_to_char(ch, "You have to have completed quest %s first.\r\n", - QST_NAME(real_quest(QST_PREV(rnum)))); - if (QST_TIME(rnum) != -1) - send_to_char(ch, - "There is a time limit of %d turn%s to complete the quest.\r\n", - QST_TIME(rnum), - QST_TIME(rnum) == 1 ? "" : "s"); - } else - send_to_char(ch, "There is no further information on that quest.\r\n"); + if ((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING) + send_to_char(ch, "That is not a valid quest!\r\n"); + else if ((rnum = real_quest(vnum)) == NOTHING) + send_to_char(ch, "That is not a valid quest!\r\n"); + else if (QST_INFO(rnum)) { + send_to_char(ch,"Complete Details on Quest %d \tc%s\tn:\r\n%s", + vnum, + QST_DESC(rnum), + QST_INFO(rnum)); + if (QST_PREV(rnum) != NOTHING) + send_to_char(ch, "You have to have completed quest %s first.\r\n", + QST_NAME(real_quest(QST_PREV(rnum)))); + if (QST_TIME(rnum) != -1) + send_to_char(ch, + "There is a time limit of %d turn%s to complete the quest.\r\n", + QST_TIME(rnum), + QST_TIME(rnum) == 1 ? "" : "s"); + } else + send_to_char(ch, "There is no further information on that quest.\r\n"); } static void quest_quit(struct char_data *ch) { - qst_rnum rnum; + qst_rnum rnum; - if (GET_QUEST(ch) == NOTHING) - send_to_char(ch, "But you currently aren't on a quest!\r\n"); - else if ((rnum = real_quest(GET_QUEST(ch))) == NOTHING) { - clear_quest(ch); - send_to_char(ch, "You are now no longer part of the quest.\r\n"); - save_char(ch); - } else { - clear_quest(ch); - if (QST_QUIT(rnum) && (str_cmp(QST_QUIT(rnum), "undefined") != 0)) - send_to_char(ch, "%s", QST_QUIT(rnum)); - else - send_to_char(ch, "You are now no longer part of the quest.\r\n"); - if (QST_PENALTY(rnum)) { - GET_QUESTPOINTS(ch) -= QST_PENALTY(rnum); - send_to_char(ch, - "You have lost %d quest points for your cowardice.\r\n", - QST_PENALTY(rnum)); + if (GET_QUEST(ch) == NOTHING) + send_to_char(ch, "But you currently aren't on a quest!\r\n"); + else if ((rnum = real_quest(GET_QUEST(ch))) == NOTHING) { + clear_quest(ch); + send_to_char(ch, "You are now no longer part of the quest.\r\n"); + save_char(ch); + } else { + clear_quest(ch); + if (QST_QUIT(rnum) && (str_cmp(QST_QUIT(rnum), "undefined") != 0)) + send_to_char(ch, "%s", QST_QUIT(rnum)); + else + send_to_char(ch, "You are now no longer part of the quest.\r\n"); + if (QST_PENALTY(rnum)) { + GET_QUESTPOINTS(ch) -= QST_PENALTY(rnum); + send_to_char(ch, + "You have lost %d quest points for your cowardice.\r\n", + QST_PENALTY(rnum)); + } + save_char(ch); } - save_char(ch); - } } static void quest_progress(struct char_data *ch) { - qst_rnum rnum; + qst_rnum rnum; - if (GET_QUEST(ch) == NOTHING) - send_to_char(ch, "But you currently aren't on a quest!\r\n"); - else if ((rnum = real_quest(GET_QUEST(ch))) == NOTHING) { - clear_quest(ch); - send_to_char(ch, "Your quest seems to no longer exist.\r\n"); - } else { - send_to_char(ch, "You are on the following quest:\r\n%s\r\n%s", - QST_DESC(rnum), QST_INFO(rnum)); - if (QST_QUANTITY(rnum) > 1) - send_to_char(ch, - "You still have to achieve %d out of %d goals for the quest.\r\n", - GET_QUEST_COUNTER(ch), QST_QUANTITY(rnum)); - if (GET_QUEST_TIME(ch) > 0) - send_to_char(ch, - "You have %d turn%s remaining to complete the quest.\r\n", - GET_QUEST_TIME(ch), - GET_QUEST_TIME(ch) == 1 ? "" : "s"); - } + if (GET_QUEST(ch) == NOTHING) + send_to_char(ch, "But you currently aren't on a quest!\r\n"); + else if ((rnum = real_quest(GET_QUEST(ch))) == NOTHING) { + clear_quest(ch); + send_to_char(ch, "Your quest seems to no longer exist.\r\n"); + } else { + send_to_char(ch, "You are on the following quest:\r\n%s\r\n%s", + QST_DESC(rnum), QST_INFO(rnum)); + if (QST_QUANTITY(rnum) > 1) + send_to_char(ch, + "You still have to achieve %d out of %d goals for the quest.\r\n", + GET_QUEST_COUNTER(ch), QST_QUANTITY(rnum)); + if (GET_QUEST_TIME(ch) > 0) + send_to_char(ch, + "You have %d turn%s remaining to complete the quest.\r\n", + GET_QUEST_TIME(ch), + GET_QUEST_TIME(ch) == 1 ? "" : "s"); + } } static void quest_show(struct char_data *ch, mob_vnum qm) { - qst_rnum rnum; - int counter = 0; + qst_rnum rnum; + int counter = 0; - send_to_char(ch, - "The following quests are available:\r\n" - "Index Description ( Vnum) Done?\r\n" - "----- ---------------------------------------------------- ------- -----\r\n"); - for (rnum = 0; rnum < total_quests; rnum++) - if (qm == QST_MASTER(rnum)) - send_to_char(ch, "\tg%4d\tn) \tc%-52.52s\tn \ty(%5d)\tn \ty(%s)\tn\r\n", - ++counter, QST_DESC(rnum), QST_NUM(rnum), - (is_complete(ch, QST_NUM(rnum)) ? "Yes" : "No ")); - if (!counter) - send_to_char(ch, "There are no quests available here at the moment.\r\n"); + send_to_char(ch, + "The following quests are available:\r\n" + "Index Description ( Vnum) Done?\r\n" + "----- ---------------------------------------------------- ------- -----\r\n"); + for (rnum = 0; rnum < total_quests; rnum++) + if (qm == QST_MASTER(rnum)) + send_to_char(ch, "\tg%4d\tn) \tc%-52.52s\tn \ty(%5d)\tn \ty(%s)\tn\r\n", + ++counter, QST_DESC(rnum), QST_NUM(rnum), + (is_complete(ch, QST_NUM(rnum)) ? "Yes" : "No ")); + if (!counter) + send_to_char(ch, "There are no quests available here at the moment.\r\n"); } static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH]) { - qst_rnum rnum; - mob_rnum qmrnum; - char buf[MAX_STRING_LENGTH]; - char targetname[MAX_STRING_LENGTH]; + qst_rnum rnum; + mob_rnum qmrnum; + char buf[MAX_STRING_LENGTH]; + char targetname[MAX_STRING_LENGTH]; - if (!*argument) - send_to_char(ch, "%s\r\n", quest_imm_usage); - else if ((rnum = real_quest(atoi(argument))) == NOTHING ) - send_to_char(ch, "That quest does not exist.\r\n"); - else { - sprintbit(QST_FLAGS(rnum), aq_flags, buf, sizeof(buf)); - switch (QST_TYPE(rnum)) { - case AQ_OBJ_FIND: - case AQ_OBJ_RETURN: - snprintf(targetname, sizeof(targetname), "%s", - real_object(QST_TARGET(rnum)) == NOTHING ? - "An unknown object" : - obj_proto[real_object(QST_TARGET(rnum))].short_description); - break; - case AQ_ROOM_FIND: - case AQ_ROOM_CLEAR: - snprintf(targetname, sizeof(targetname), "%s", - real_room(QST_TARGET(rnum)) == NOWHERE ? - "An unknown room" : - world[real_room(QST_TARGET(rnum))].name); - break; - case AQ_MOB_FIND: - case AQ_MOB_KILL: - case AQ_MOB_SAVE: - snprintf(targetname, sizeof(targetname), "%s", - real_mobile(QST_TARGET(rnum)) == NOBODY ? - "An unknown mobile" : - GET_NAME(&mob_proto[real_mobile(QST_TARGET(rnum))])); - break; - default: - snprintf(targetname, sizeof(targetname), "Unknown"); - break; + if (!*argument) + send_to_char(ch, "%s\r\n", quest_imm_usage); + else if ((rnum = real_quest(atoi(argument))) == NOTHING ) + send_to_char(ch, "That quest does not exist.\r\n"); + else { + sprintbit(QST_FLAGS(rnum), aq_flags, buf, sizeof(buf)); + switch (QST_TYPE(rnum)) { + case AQ_OBJ_FIND: + case AQ_OBJ_RETURN: + snprintf(targetname, sizeof(targetname), "%s", + real_object(QST_TARGET(rnum)) == NOTHING ? + "An unknown object" : + obj_proto[real_object(QST_TARGET(rnum))].short_description); + break; + case AQ_ROOM_FIND: + case AQ_ROOM_CLEAR: + snprintf(targetname, sizeof(targetname), "%s", + real_room(QST_TARGET(rnum)) == NOWHERE ? + "An unknown room" : + world[real_room(QST_TARGET(rnum))].name); + break; + case AQ_MOB_FIND: + case AQ_MOB_KILL: + case AQ_MOB_SAVE: + snprintf(targetname, sizeof(targetname), "%s", + real_mobile(QST_TARGET(rnum)) == NOBODY ? + "An unknown mobile" : + GET_NAME(&mob_proto[real_mobile(QST_TARGET(rnum))])); + break; + default: + snprintf(targetname, sizeof(targetname), "Unknown"); + break; + } + qmrnum = real_mobile(QST_MASTER(rnum)); + send_to_char(ch, + "VNum : [\ty%5d\tn], RNum: [\ty%5d\tn] -- Questmaster: [\ty%5d\tn] \ty%s\tn\r\n" + "Name : \ty%s\tn\r\n" + "Desc : \ty%s\tn\r\n" + "Accept Message:\r\n\tc%s\tn" + "Completion Message:\r\n\tc%s\tn" + "Quit Message:\r\n\tc%s\tn" + "Type : \ty%s\tn\r\n" + "Target: \ty%d\tn \ty%s\tn, Quantity: \ty%d\tn\r\n" + "Value : \ty%d\tn, Penalty: \ty%d\tn, Min Level: \ty%2d\tn, Max Level: \ty%2d\tn\r\n" + "Flags : \tc%s\tn\r\n", + QST_NUM(rnum), rnum, + QST_MASTER(rnum) == NOBODY ? -1 : QST_MASTER(rnum), + (qmrnum == NOBODY) ? "(Invalid vnum)" : GET_NAME(&mob_proto[(qmrnum)]), + QST_NAME(rnum), QST_DESC(rnum), + QST_INFO(rnum), QST_DONE(rnum), + (QST_QUIT(rnum) && + (str_cmp(QST_QUIT(rnum), "undefined") != 0) + ? QST_QUIT(rnum) : "Nothing\r\n"), + quest_types[QST_TYPE(rnum)], + QST_TARGET(rnum) == NOBODY ? -1 : QST_TARGET(rnum), + targetname, + QST_QUANTITY(rnum), + QST_POINTS(rnum), QST_PENALTY(rnum), QST_MINLEVEL(rnum), + QST_MAXLEVEL(rnum), buf); + if (QST_PREREQ(rnum) != NOTHING) + send_to_char(ch, "Preq : [\ty%5d\tn] \ty%s\tn\r\n", + QST_PREREQ(rnum) == NOTHING ? -1 : QST_PREREQ(rnum), + QST_PREREQ(rnum) == NOTHING ? "" : + real_object(QST_PREREQ(rnum)) == NOTHING ? "an unknown object" : + obj_proto[real_object(QST_PREREQ(rnum))].short_description); + if (QST_TYPE(rnum) == AQ_OBJ_RETURN) + send_to_char(ch, "Mob : [\ty%5d\tn] \ty%s\tn\r\n", + QST_RETURNMOB(rnum), + real_mobile(QST_RETURNMOB(rnum)) == NOBODY ? "an unknown mob" : + mob_proto[real_mobile(QST_RETURNMOB(rnum))].player.short_descr); + if (QST_TIME(rnum) != -1) + send_to_char(ch, "Limit : There is a time limit of %d turn%s to complete.\r\n", + QST_TIME(rnum), + QST_TIME(rnum) == 1 ? "" : "s"); + else + send_to_char(ch, "Limit : There is no time limit on this quest.\r\n"); + send_to_char(ch, "Prior :"); + if (QST_PREV(rnum) == NOTHING) + send_to_char(ch, " \tyNone.\tn\r\n"); + else + send_to_char(ch, " [\ty%5d\tn] \tc%s\tn\r\n", + QST_PREV(rnum), QST_DESC(real_quest(QST_PREV(rnum)))); + send_to_char(ch, "Next :"); + if (QST_NEXT(rnum) == NOTHING) + send_to_char(ch, " \tyNone.\tn\r\n"); + else + send_to_char(ch, " [\ty%5d\tn] \tc%s\tn\r\n", + QST_NEXT(rnum), QST_DESC(real_quest(QST_NEXT(rnum)))); } - qmrnum = real_mobile(QST_MASTER(rnum)); - send_to_char(ch, - "VNum : [\ty%5d\tn], RNum: [\ty%5d\tn] -- Questmaster: [\ty%5d\tn] \ty%s\tn\r\n" - "Name : \ty%s\tn\r\n" - "Desc : \ty%s\tn\r\n" - "Accept Message:\r\n\tc%s\tn" - "Completion Message:\r\n\tc%s\tn" - "Quit Message:\r\n\tc%s\tn" - "Type : \ty%s\tn\r\n" - "Target: \ty%d\tn \ty%s\tn, Quantity: \ty%d\tn\r\n" - "Value : \ty%d\tn, Penalty: \ty%d\tn, Min Level: \ty%2d\tn, Max Level: \ty%2d\tn\r\n" - "Flags : \tc%s\tn\r\n", - QST_NUM(rnum), rnum, - QST_MASTER(rnum) == NOBODY ? -1 : QST_MASTER(rnum), - (qmrnum == NOBODY) ? "(Invalid vnum)" : GET_NAME(&mob_proto[(qmrnum)]), - QST_NAME(rnum), QST_DESC(rnum), - QST_INFO(rnum), QST_DONE(rnum), - (QST_QUIT(rnum) && - (str_cmp(QST_QUIT(rnum), "undefined") != 0) - ? QST_QUIT(rnum) : "Nothing\r\n"), - quest_types[QST_TYPE(rnum)], - QST_TARGET(rnum) == NOBODY ? -1 : QST_TARGET(rnum), - targetname, - QST_QUANTITY(rnum), - QST_POINTS(rnum), QST_PENALTY(rnum), QST_MINLEVEL(rnum), - QST_MAXLEVEL(rnum), buf); - if (QST_PREREQ(rnum) != NOTHING) - send_to_char(ch, "Preq : [\ty%5d\tn] \ty%s\tn\r\n", - QST_PREREQ(rnum) == NOTHING ? -1 : QST_PREREQ(rnum), - QST_PREREQ(rnum) == NOTHING ? "" : - real_object(QST_PREREQ(rnum)) == NOTHING ? "an unknown object" : - obj_proto[real_object(QST_PREREQ(rnum))].short_description); - if (QST_TYPE(rnum) == AQ_OBJ_RETURN) - send_to_char(ch, "Mob : [\ty%5d\tn] \ty%s\tn\r\n", - QST_RETURNMOB(rnum), - real_mobile(QST_RETURNMOB(rnum)) == NOBODY ? "an unknown mob" : - mob_proto[real_mobile(QST_RETURNMOB(rnum))].player.short_descr); - if (QST_TIME(rnum) != -1) - send_to_char(ch, "Limit : There is a time limit of %d turn%s to complete.\r\n", - QST_TIME(rnum), - QST_TIME(rnum) == 1 ? "" : "s"); - else - send_to_char(ch, "Limit : There is no time limit on this quest.\r\n"); - send_to_char(ch, "Prior :"); - if (QST_PREV(rnum) == NOTHING) - send_to_char(ch, " \tyNone.\tn\r\n"); - else - send_to_char(ch, " [\ty%5d\tn] \tc%s\tn\r\n", - QST_PREV(rnum), QST_DESC(real_quest(QST_PREV(rnum)))); - send_to_char(ch, "Next :"); - if (QST_NEXT(rnum) == NOTHING) - send_to_char(ch, " \tyNone.\tn\r\n"); - else - send_to_char(ch, " [\ty%5d\tn] \tc%s\tn\r\n", - QST_NEXT(rnum), QST_DESC(real_quest(QST_NEXT(rnum)))); - } } /*--------------------------------------------------------------------------*/ @@ -752,83 +754,83 @@ static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH]) ACMD(do_quest) { - char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; - int tp; + char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; + int tp; - two_arguments(argument, arg1, arg2); - if (!*arg1) - send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ? - quest_mort_usage : quest_imm_usage); - else if (((tp = search_block(arg1, quest_cmd, FALSE)) == -1)) - send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ? - quest_mort_usage : quest_imm_usage); - else { - switch (tp) { - case SCMD_QUEST_LIST: - case SCMD_QUEST_JOIN: - /* list, join should hve been handled by questmaster spec proc */ - send_to_char(ch, "Sorry, but you cannot do that here!\r\n"); - break; - case SCMD_QUEST_HISTORY: - quest_hist(ch); - break; - case SCMD_QUEST_LEAVE: - quest_quit(ch); - break; - case SCMD_QUEST_PROGRESS: - quest_progress(ch); - break; - case SCMD_QUEST_STATUS: - if (GET_LEVEL(ch) < LVL_IMMORT) - send_to_char(ch, "%s\r\n", quest_mort_usage); - else - quest_stat(ch, arg2); - break; - default: /* Whe should never get here, but... */ + two_arguments(argument, arg1, arg2); + if (!*arg1) send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ? quest_mort_usage : quest_imm_usage); - break; - } /* switch on subcmd number */ - } + else if (((tp = search_block(arg1, quest_cmd, FALSE)) == -1)) + send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ? + quest_mort_usage : quest_imm_usage); + else { + switch (tp) { + case SCMD_QUEST_LIST: + case SCMD_QUEST_JOIN: + /* list, join should hve been handled by questmaster spec proc */ + send_to_char(ch, "Sorry, but you cannot do that here!\r\n"); + break; + case SCMD_QUEST_HISTORY: + quest_hist(ch); + break; + case SCMD_QUEST_LEAVE: + quest_quit(ch); + break; + case SCMD_QUEST_PROGRESS: + quest_progress(ch); + break; + case SCMD_QUEST_STATUS: + if (GET_LEVEL(ch) < LVL_IMMORT) + send_to_char(ch, "%s\r\n", quest_mort_usage); + else + quest_stat(ch, arg2); + break; + default: /* Whe should never get here, but... */ + send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ? + quest_mort_usage : quest_imm_usage); + break; + } /* switch on subcmd number */ + } } SPECIAL(questmaster) { - qst_rnum rnum; - char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; - int tp; - struct char_data *qm = (struct char_data *)me; + qst_rnum rnum; + char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; + int tp; + struct char_data *qm = (struct char_data *)me; - /* check that qm mob has quests assigned */ - for (rnum = 0; (rnum < total_quests && - QST_MASTER(rnum) != GET_MOB_VNUM(qm)) ; rnum ++); - if (rnum >= total_quests) - return FALSE; /* No quests for this mob */ - else if (QST_FUNC(rnum) && (QST_FUNC(rnum) (ch, me, cmd, argument))) - return TRUE; /* The secondary spec proc handled this command */ - else if (CMD_IS("quest")) { - two_arguments(argument, arg1, arg2); - if (!*arg1) - return FALSE; - else if (((tp = search_block(arg1, quest_cmd, FALSE)) == -1)) - return FALSE; - else { - switch (tp) { - case SCMD_QUEST_LIST: - if (!*arg2) - quest_show(ch, GET_MOB_VNUM(qm)); - else - quest_list(ch, qm, arg2); - break; - case SCMD_QUEST_JOIN: - quest_join(ch, qm, arg2); - break; - default: - return FALSE; /* fall through to the do_quest command processor */ - } /* switch on subcmd number */ - return TRUE; + /* check that qm mob has quests assigned */ + for (rnum = 0; (rnum < total_quests && + QST_MASTER(rnum) != GET_MOB_VNUM(qm)) ; rnum ++); + if (rnum >= total_quests) + return FALSE; /* No quests for this mob */ + else if (QST_FUNC(rnum) && (QST_FUNC(rnum) (ch, me, cmd, argument))) + return TRUE; /* The secondary spec proc handled this command */ + else if (CMD_IS("quest")) { + two_arguments(argument, arg1, arg2); + if (!*arg1) + return FALSE; + else if (((tp = search_block(arg1, quest_cmd, FALSE)) == -1)) + return FALSE; + else { + switch (tp) { + case SCMD_QUEST_LIST: + if (!*arg2) + quest_show(ch, GET_MOB_VNUM(qm)); + else + quest_list(ch, qm, arg2); + break; + case SCMD_QUEST_JOIN: + quest_join(ch, qm, arg2); + break; + default: + return FALSE; /* fall through to the do_quest command processor */ + } /* switch on subcmd number */ + return TRUE; + } + } else { + return FALSE; /* not a questmaster command */ } - } else { - return FALSE; /* not a questmaster command */ - } } diff --git a/src/quest.h b/src/quest.h index a52a00e..5db8807 100644 --- a/src/quest.h +++ b/src/quest.h @@ -36,24 +36,24 @@ #define NUM_AQ_FLAGS 1 /* Main quest struct ************************************************** */ struct aq_data { - qst_vnum vnum; /* Virtual nr of the quest */ - char *name; /* For qlist and the sort */ - char *desc; /* Description of the quest */ - char *info; /* Message displayed when accepted */ - char *done; /* Message displayed when completed */ - char *quit; /* Message displayed when quit quest */ - long flags; /* Flags (repeatable, etc */ - int type; /* Quest type */ - mob_vnum qm; /* questmaster offering quest */ - int target; /* Target value */ - obj_vnum prereq; /* Object required to undertake quest */ - int value[7]; /* Quest values */ - int gold_reward; /* Number of gold coins given as reward */ - int exp_reward; /* Experience points given as a reward */ - obj_vnum obj_reward; /* vnum of object given as a reward */ - qst_vnum prev_quest; /* Link to prev quest, NOTHING is open */ - qst_vnum next_quest; /* Link to next quest, NOTHING is end */ - SPECIAL (*func); /* secondary spec_proc for the QM */ + qst_vnum vnum; /* Virtual nr of the quest */ + char *name; /* For qlist and the sort */ + char *desc; /* Description of the quest */ + char *info; /* Message displayed when accepted */ + char *done; /* Message displayed when completed */ + char *quit; /* Message displayed when quit quest */ + long flags; /* Flags (repeatable, etc */ + int type; /* Quest type */ + mob_vnum qm; /* questmaster offering quest */ + int target; /* Target value */ + obj_vnum prereq; /* Object required to undertake quest */ + int value[7]; /* Quest values */ + int gold_reward; /* Number of gold coins given as reward */ + int exp_reward; /* Experience points given as a reward */ + obj_vnum obj_reward; /* vnum of object given as a reward */ + qst_vnum prev_quest; /* Link to prev quest, NOTHING is open */ + qst_vnum next_quest; /* Link to next quest, NOTHING is end */ + SPECIAL (*func); /* secondary spec_proc for the QM */ }; #define QST_NUM(i) (aquest_table[i].vnum) #define QST_NAME(i) (aquest_table[i].name) diff --git a/src/screen.h b/src/screen.h index 463908d..a17cd02 100644 --- a/src/screen.h +++ b/src/screen.h @@ -1,183 +1,183 @@ /** * @file screen.h * Header file with ANSI color codes for online color. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. */ #ifndef _SCREEN_H_ #define _SCREEN_H_ -#define CNRM "\x1B[0;0m" /* "Normal" */ -#define CNUL "" /* No Change */ -#define KNRM "\x1B[0m" /* Foreground "Normal" */ -#define KBLK "\x1b[0;30m" /* Foreground Black */ -#define KRED "\x1B[0;31m" /* Foreground Dark Red */ -#define KGRN "\x1B[0;32m" /* Foreground Dark Green */ -#define KYEL "\x1B[0;33m" /* Foreground Dark Yellow */ -#define KBLU "\x1B[0;34m" /* Foreground Dark Blue */ -#define KMAG "\x1B[0;35m" /* Foreground Dark Magenta */ -#define KCYN "\x1B[0;36m" /* Foreground Dark Cyan */ -#define KWHT "\x1B[0;37m" /* Foreground Dark White (Light Gray) */ -#define KNUL "" /* Foreground No Change */ -#define BBLK "\x1B[1;30m" /* Foreground Bright Black (Dark Gray) */ -#define BRED "\x1B[1;31m" /* Foreground Bright Red */ -#define BGRN "\x1B[1;32m" /* Foreground Bright Green */ -#define BYEL "\x1B[1;33m" /* Foreground Bright Yellow */ -#define BBLU "\x1B[1;34m" /* Foreground Bright Blue */ -#define BMAG "\x1B[1;35m" /* Foreground Bright Magenta */ -#define BCYN "\x1B[1;36m" /* Foreground Bright Cyan */ -#define BWHT "\x1B[1;37m" /* Foreground Bright White */ +#define CNRM "\x1B[0;0m" /* "Normal" */ +#define CNUL "" /* No Change */ +#define KNRM "\x1B[0m" /* Foreground "Normal" */ +#define KBLK "\x1b[0;30m" /* Foreground Black */ +#define KRED "\x1B[0;31m" /* Foreground Dark Red */ +#define KGRN "\x1B[0;32m" /* Foreground Dark Green */ +#define KYEL "\x1B[0;33m" /* Foreground Dark Yellow */ +#define KBLU "\x1B[0;34m" /* Foreground Dark Blue */ +#define KMAG "\x1B[0;35m" /* Foreground Dark Magenta */ +#define KCYN "\x1B[0;36m" /* Foreground Dark Cyan */ +#define KWHT "\x1B[0;37m" /* Foreground Dark White (Light Gray) */ +#define KNUL "" /* Foreground No Change */ +#define BBLK "\x1B[1;30m" /* Foreground Bright Black (Dark Gray) */ +#define BRED "\x1B[1;31m" /* Foreground Bright Red */ +#define BGRN "\x1B[1;32m" /* Foreground Bright Green */ +#define BYEL "\x1B[1;33m" /* Foreground Bright Yellow */ +#define BBLU "\x1B[1;34m" /* Foreground Bright Blue */ +#define BMAG "\x1B[1;35m" /* Foreground Bright Magenta */ +#define BCYN "\x1B[1;36m" /* Foreground Bright Cyan */ +#define BWHT "\x1B[1;37m" /* Foreground Bright White */ -#define BKBLK "\x1B[40m" /* Background Black */ -#define BKRED "\x1B[41m" /* Background Dark Red */ -#define BKGRN "\x1B[42m" /* Background Dark Green */ -#define BKYEL "\x1B[43m" /* Background Dark Yellow */ -#define BKBLU "\x1B[44m" /* Background Dark Blue */ -#define BKMAG "\x1B[45m" /* Background Dark Magenta */ -#define BKCYN "\x1B[46m" /* Background Dark Cyan */ -#define BKWHT "\x1B[47m" /* Background Dark White (Light Gray) */ +#define BKBLK "\x1B[40m" /* Background Black */ +#define BKRED "\x1B[41m" /* Background Dark Red */ +#define BKGRN "\x1B[42m" /* Background Dark Green */ +#define BKYEL "\x1B[43m" /* Background Dark Yellow */ +#define BKBLU "\x1B[44m" /* Background Dark Blue */ +#define BKMAG "\x1B[45m" /* Background Dark Magenta */ +#define BKCYN "\x1B[46m" /* Background Dark Cyan */ +#define BKWHT "\x1B[47m" /* Background Dark White (Light Gray) */ -#define FBLK "\x1B[5;30m" /* Foreground Flashing Black (silly) */ -#define FRED "\x1B[5;31m" /* Foreground Flashing Dark Red */ -#define FGRN "\x1B[5;32m" /* Foreground Flashing Dark Green */ -#define FYEL "\x1B[5;33m" /* Foreground Flashing Dark Yellow */ -#define FBLU "\x1B[5;34m" /* Foreground Flashing Dark Blue */ -#define FMAG "\x1B[5;35m" /* Foreground Flashing Dark Magenta */ -#define FCYN "\x1B[5;36m" /* Foreground Flashing Dark Cyan */ -#define FWHT "\x1B[5;37m" /* Foreground Flashing Light Gray */ +#define FBLK "\x1B[5;30m" /* Foreground Flashing Black (silly) */ +#define FRED "\x1B[5;31m" /* Foreground Flashing Dark Red */ +#define FGRN "\x1B[5;32m" /* Foreground Flashing Dark Green */ +#define FYEL "\x1B[5;33m" /* Foreground Flashing Dark Yellow */ +#define FBLU "\x1B[5;34m" /* Foreground Flashing Dark Blue */ +#define FMAG "\x1B[5;35m" /* Foreground Flashing Dark Magenta */ +#define FCYN "\x1B[5;36m" /* Foreground Flashing Dark Cyan */ +#define FWHT "\x1B[5;37m" /* Foreground Flashing Light Gray */ -#define BFBLK "\x1B[1;5;30m" /* Foreground Flashing Dark Gray */ -#define BFRED "\x1B[1;5;31m" /* Foreground Flashing Bright Red */ -#define BFGRN "\x1B[1;5;32m" /* Foreground Flashing Bright Green */ -#define BFYEL "\x1B[1;5;33m" /* Foreground Flashing Bright Yellow */ -#define BFBLU "\x1B[1;5;34m" /* Foreground Flashing Bright Blue */ -#define BFMAG "\x1B[1;5;35m" /* Foreground Flashing Bright Magenta */ -#define BFCYN "\x1B[1;5;36m" /* Foreground Flashing Bright Cyan */ -#define BFWHT "\x1B[1;5;37m" /* Foreground Flashing Bright White */ +#define BFBLK "\x1B[1;5;30m" /* Foreground Flashing Dark Gray */ +#define BFRED "\x1B[1;5;31m" /* Foreground Flashing Bright Red */ +#define BFGRN "\x1B[1;5;32m" /* Foreground Flashing Bright Green */ +#define BFYEL "\x1B[1;5;33m" /* Foreground Flashing Bright Yellow */ +#define BFBLU "\x1B[1;5;34m" /* Foreground Flashing Bright Blue */ +#define BFMAG "\x1B[1;5;35m" /* Foreground Flashing Bright Magenta */ +#define BFCYN "\x1B[1;5;36m" /* Foreground Flashing Bright Cyan */ +#define BFWHT "\x1B[1;5;37m" /* Foreground Flashing Bright White */ -#define CBEEP "\x07" +#define CBEEP "\x07" #define CAT "@@" -#define CAMP "&" -#define CSLH "\\" +#define CAMP "&" +#define CSLH "\\" -#define CUDL "\x1B[4m" /* Underline ANSI code */ +#define CUDL "\x1B[4m" /* Underline ANSI code */ #define CFSH "\x1B[5m" /* Flashing ANSI code. Change to #define CFSH "" if * you want to disable flashing colour codes - */ -#define CRVS "\x1B[7m" /* Reverse video ANSI code */ + */ +#define CRVS "\x1B[7m" /* Reverse video ANSI code */ -/* conditional color. pass it a pointer to a char_data and a color level. */ -#define C_OFF 0 -#define C_SPR 1 -#define C_NRM 2 -#define C_CMP 3 +/* conditional color. pass it a pointer to a char_data and a color level. */ +#define C_OFF 0 +#define C_SPR 1 +#define C_NRM 2 +#define C_CMP 3 #define _clrlevel(ch) (!IS_NPC(ch) ? (PRF_FLAGGED((ch), PRF_COLOR_1) ? 1 : 0) + \ - (PRF_FLAGGED((ch), PRF_COLOR_2) ? 2 : 0) : 0) -#define clr(ch,lvl) (_clrlevel(ch) >= (lvl)) + (PRF_FLAGGED((ch), PRF_COLOR_2) ? 2 : 0) : 0) +#define clr(ch,lvl) (_clrlevel(ch) >= (lvl)) -/* Player dependant foreground color codes */ -#define CCNRM(ch,lvl) (clr((ch),(lvl))?KNRM:KNUL) -#define CCBLK(ch,lvl) (clr((ch),(lvl))?KBLK:CNUL) -#define CCRED(ch,lvl) (clr((ch),(lvl))?KRED:KNUL) -#define CCGRN(ch,lvl) (clr((ch),(lvl))?KGRN:KNUL) -#define CCYEL(ch,lvl) (clr((ch),(lvl))?KYEL:KNUL) -#define CCBLU(ch,lvl) (clr((ch),(lvl))?KBLU:KNUL) -#define CCMAG(ch,lvl) (clr((ch),(lvl))?KMAG:KNUL) -#define CCCYN(ch,lvl) (clr((ch),(lvl))?KCYN:KNUL) -#define CCWHT(ch,lvl) (clr((ch),(lvl))?KWHT:KNUL) +/* Player dependant foreground color codes */ +#define CCNRM(ch,lvl) (clr((ch),(lvl))?KNRM:KNUL) +#define CCBLK(ch,lvl) (clr((ch),(lvl))?KBLK:CNUL) +#define CCRED(ch,lvl) (clr((ch),(lvl))?KRED:KNUL) +#define CCGRN(ch,lvl) (clr((ch),(lvl))?KGRN:KNUL) +#define CCYEL(ch,lvl) (clr((ch),(lvl))?KYEL:KNUL) +#define CCBLU(ch,lvl) (clr((ch),(lvl))?KBLU:KNUL) +#define CCMAG(ch,lvl) (clr((ch),(lvl))?KMAG:KNUL) +#define CCCYN(ch,lvl) (clr((ch),(lvl))?KCYN:KNUL) +#define CCWHT(ch,lvl) (clr((ch),(lvl))?KWHT:KNUL) -/* Bright colors */ -#define CBRED(ch,lvl) (clr((ch),(lvl))?BRED:CNUL) -#define CBGRN(ch,lvl) (clr((ch),(lvl))?BGRN:CNUL) -#define CBYEL(ch,lvl) (clr((ch),(lvl))?BYEL:CNUL) -#define CBBLU(ch,lvl) (clr((ch),(lvl))?BBLU:CNUL) -#define CBMAG(ch,lvl) (clr((ch),(lvl))?BMAG:CNUL) -#define CBCYN(ch,lvl) (clr((ch),(lvl))?BCYN:CNUL) -#define CBWHT(ch,lvl) (clr((ch),(lvl))?BWHT:CNUL) -#define CBBLK(ch,lvl) (clr((ch),(lvl))?BBLK:CNUL) +/* Bright colors */ +#define CBRED(ch,lvl) (clr((ch),(lvl))?BRED:CNUL) +#define CBGRN(ch,lvl) (clr((ch),(lvl))?BGRN:CNUL) +#define CBYEL(ch,lvl) (clr((ch),(lvl))?BYEL:CNUL) +#define CBBLU(ch,lvl) (clr((ch),(lvl))?BBLU:CNUL) +#define CBMAG(ch,lvl) (clr((ch),(lvl))?BMAG:CNUL) +#define CBCYN(ch,lvl) (clr((ch),(lvl))?BCYN:CNUL) +#define CBWHT(ch,lvl) (clr((ch),(lvl))?BWHT:CNUL) +#define CBBLK(ch,lvl) (clr((ch),(lvl))?BBLK:CNUL) -/* Flashing colors */ -#define CCFRED(ch,lvl) (clr((ch),(lvl))?FRED:CNUL) -#define CCFGRN(ch,lvl) (clr((ch),(lvl))?FGRN:CNUL) -#define CCFYEL(ch,lvl) (clr((ch),(lvl))?FYEL:CNUL) -#define CCFBLU(ch,lvl) (clr((ch),(lvl))?FBLU:CNUL) -#define CCFMAG(ch,lvl) (clr((ch),(lvl))?FMAG:CNUL) -#define CCFCYN(ch,lvl) (clr((ch),(lvl))?FCYN:CNUL) -#define CCFWHT(ch,lvl) (clr((ch),(lvl))?FWHT:CNUL) +/* Flashing colors */ +#define CCFRED(ch,lvl) (clr((ch),(lvl))?FRED:CNUL) +#define CCFGRN(ch,lvl) (clr((ch),(lvl))?FGRN:CNUL) +#define CCFYEL(ch,lvl) (clr((ch),(lvl))?FYEL:CNUL) +#define CCFBLU(ch,lvl) (clr((ch),(lvl))?FBLU:CNUL) +#define CCFMAG(ch,lvl) (clr((ch),(lvl))?FMAG:CNUL) +#define CCFCYN(ch,lvl) (clr((ch),(lvl))?FCYN:CNUL) +#define CCFWHT(ch,lvl) (clr((ch),(lvl))?FWHT:CNUL) -/* Flashing bright colors */ -#define CBFRED(ch,lvl) (clr((ch),(lvl))?BFRED:CNUL) -#define CBFGRN(ch,lvl) (clr((ch),(lvl))?BFGRN:CNUL) -#define CBFYEL(ch,lvl) (clr((ch),(lvl))?BFYEL:CNUL) -#define CBFBLU(ch,lvl) (clr((ch),(lvl))?BFBLU:CNUL) -#define CBFMAG(ch,lvl) (clr((ch),(lvl))?BFMAG:CNUL) -#define CBFCYN(ch,lvl) (clr((ch),(lvl))?BFCYN:CNUL) -#define CBFWHT(ch,lvl) (clr((ch),(lvl))?BFWHT:CNUL) +/* Flashing bright colors */ +#define CBFRED(ch,lvl) (clr((ch),(lvl))?BFRED:CNUL) +#define CBFGRN(ch,lvl) (clr((ch),(lvl))?BFGRN:CNUL) +#define CBFYEL(ch,lvl) (clr((ch),(lvl))?BFYEL:CNUL) +#define CBFBLU(ch,lvl) (clr((ch),(lvl))?BFBLU:CNUL) +#define CBFMAG(ch,lvl) (clr((ch),(lvl))?BFMAG:CNUL) +#define CBFCYN(ch,lvl) (clr((ch),(lvl))?BFCYN:CNUL) +#define CBFWHT(ch,lvl) (clr((ch),(lvl))?BFWHT:CNUL) -/* Background colors */ -#define CBKRED(ch,lvl) (clr((ch),(lvl))?BKRED:CNUL) -#define CBKGRN(ch,lvl) (clr((ch),(lvl))?BKGRN:CNUL) -#define CBKYEL(ch,lvl) (clr((ch),(lvl))?BKYEL:CNUL) -#define CBKBLU(ch,lvl) (clr((ch),(lvl))?BKBLU:CNUL) -#define CBKMAG(ch,lvl) (clr((ch),(lvl))?BKMAG:CNUL) -#define CBKCYN(ch,lvl) (clr((ch),(lvl))?BKCYN:CNUL) -#define CBKWHT(ch,lvl) (clr((ch),(lvl))?BKWHT:CNUL) -#define CBKBLK(ch,lvl) (clr((ch),(lvl))?BKBLK:CNUL) +/* Background colors */ +#define CBKRED(ch,lvl) (clr((ch),(lvl))?BKRED:CNUL) +#define CBKGRN(ch,lvl) (clr((ch),(lvl))?BKGRN:CNUL) +#define CBKYEL(ch,lvl) (clr((ch),(lvl))?BKYEL:CNUL) +#define CBKBLU(ch,lvl) (clr((ch),(lvl))?BKBLU:CNUL) +#define CBKMAG(ch,lvl) (clr((ch),(lvl))?BKMAG:CNUL) +#define CBKCYN(ch,lvl) (clr((ch),(lvl))?BKCYN:CNUL) +#define CBKWHT(ch,lvl) (clr((ch),(lvl))?BKWHT:CNUL) +#define CBKBLK(ch,lvl) (clr((ch),(lvl))?BKBLK:CNUL) -#define COLOR_LEV(ch) (_clrlevel(ch)) +#define COLOR_LEV(ch) (_clrlevel(ch)) -/* Simplified color codes */ -#define QNRM CCNRM(ch,C_SPR) -#define QBLK CCBLK(ch,C_SPR) -#define QRED CCRED(ch,C_SPR) -#define QGRN CCGRN(ch,C_SPR) -#define QYEL CCYEL(ch,C_SPR) -#define QBLU CCBLU(ch,C_SPR) -#define QMAG CCMAG(ch,C_SPR) -#define QCYN CCCYN(ch,C_SPR) -#define QWHT CCWHT(ch,C_SPR) +/* Simplified color codes */ +#define QNRM CCNRM(ch,C_SPR) +#define QBLK CCBLK(ch,C_SPR) +#define QRED CCRED(ch,C_SPR) +#define QGRN CCGRN(ch,C_SPR) +#define QYEL CCYEL(ch,C_SPR) +#define QBLU CCBLU(ch,C_SPR) +#define QMAG CCMAG(ch,C_SPR) +#define QCYN CCCYN(ch,C_SPR) +#define QWHT CCWHT(ch,C_SPR) -/* simplified brights */ -#define QBBLK CBBLK(ch,C_SPR) -#define QBRED CBRED(ch,C_SPR) -#define QBGRN CBGRN(ch,C_SPR) -#define QBYEL CBYEL(ch,C_SPR) -#define QBBLU CBBLU(ch,C_SPR) -#define QBMAG CBMAG(ch,C_SPR) -#define QBCYN CBCYN(ch,C_SPR) -#define QBWHT CBWHT(ch,C_SPR) +/* simplified brights */ +#define QBBLK CBBLK(ch,C_SPR) +#define QBRED CBRED(ch,C_SPR) +#define QBGRN CBGRN(ch,C_SPR) +#define QBYEL CBYEL(ch,C_SPR) +#define QBBLU CBBLU(ch,C_SPR) +#define QBMAG CBMAG(ch,C_SPR) +#define QBCYN CBCYN(ch,C_SPR) +#define QBWHT CBWHT(ch,C_SPR) -/* Simplified Flashing */ -#define QFRED CCFRED(ch,C_SPR) -#define QFGRN CCFGRN(ch,C_SPR) -#define QFYEL CCFYEL(ch,C_SPR) -#define QFBLU CCFBLU(ch,C_SPR) -#define QFMAG CCFMAG(ch,C_SPR) -#define QFCYN CCFCYN(ch,C_SPR) -#define QFWHT CCFWHT(ch,C_SPR) +/* Simplified Flashing */ +#define QFRED CCFRED(ch,C_SPR) +#define QFGRN CCFGRN(ch,C_SPR) +#define QFYEL CCFYEL(ch,C_SPR) +#define QFBLU CCFBLU(ch,C_SPR) +#define QFMAG CCFMAG(ch,C_SPR) +#define QFCYN CCFCYN(ch,C_SPR) +#define QFWHT CCFWHT(ch,C_SPR) -/* Simplified Bright Flashing */ -#define QBFRED CBFRED(ch,C_SPR) -#define QBFGRN CBFGRN(ch,C_SPR) -#define QBFYEL CBFYEL(ch,C_SPR) -#define QBFBLU CBFBLU(ch,C_SPR) -#define QBFMAG CBFMAG(ch,C_SPR) -#define QBFCYN CBFCYN(ch,C_SPR) -#define QBFWHT CBFWHT(ch,C_SPR) +/* Simplified Bright Flashing */ +#define QBFRED CBFRED(ch,C_SPR) +#define QBFGRN CBFGRN(ch,C_SPR) +#define QBFYEL CBFYEL(ch,C_SPR) +#define QBFBLU CBFBLU(ch,C_SPR) +#define QBFMAG CBFMAG(ch,C_SPR) +#define QBFCYN CBFCYN(ch,C_SPR) +#define QBFWHT CBFWHT(ch,C_SPR) -/* Simplified Backgrounds */ -#define QBKBLK CBKBLK(ch,C_SPR) -#define QBKRED CBKRED(ch,C_SPR) -#define QBKGRN CBKGRN(ch,C_SPR) -#define QBKYEL CBKYEL(ch,C_SPR) -#define QBKBLU CBKBLU(ch,C_SPR) -#define QBKMAG CBKMAG(ch,C_SPR) -#define QBKCYN CBKCYN(ch,C_SPR) -#define QBKWHT CBKWHT(ch,C_SPR) +/* Simplified Backgrounds */ +#define QBKBLK CBKBLK(ch,C_SPR) +#define QBKRED CBKRED(ch,C_SPR) +#define QBKGRN CBKGRN(ch,C_SPR) +#define QBKYEL CBKYEL(ch,C_SPR) +#define QBKBLU CBKBLU(ch,C_SPR) +#define QBKMAG CBKMAG(ch,C_SPR) +#define QBKCYN CBKCYN(ch,C_SPR) +#define QBKWHT CBKWHT(ch,C_SPR) #endif /* _SCREEN_H_ */ diff --git a/src/shop.h b/src/shop.h index 16c53d3..6527626 100644 --- a/src/shop.h +++ b/src/shop.h @@ -1,13 +1,13 @@ /** * @file shop.h * Shop file definitions, structures, constants. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. */ #ifndef _SHOP_H_ #define _SHOP_H_ @@ -21,57 +21,57 @@ int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim); void destroy_shops(void); struct shop_buy_data { - int type; - char *keywords; + int type; + char *keywords; }; -#define BUY_TYPE(i) ((i).type) -#define BUY_WORD(i) ((i).keywords) +#define BUY_TYPE(i) ((i).type) +#define BUY_WORD(i) ((i).keywords) struct shop_data { - room_vnum vnum; /* Virtual number of this shop */ - obj_vnum *producing; /* Which item to produce (virtual) */ - float profit_buy; /* Factor to multiply cost with */ - float profit_sell; /* Factor to multiply cost with */ - struct shop_buy_data *type; /* Which items to trade */ - char *no_such_item1; /* Message if keeper hasn't got an item */ - char *no_such_item2; /* Message if player hasn't got an item */ - char *missing_cash1; /* Message if keeper hasn't got cash */ - char *missing_cash2; /* Message if player hasn't got cash */ - char *do_not_buy; /* If keeper dosn't buy such things */ - char *message_buy; /* Message when player buys item */ - char *message_sell; /* Message when player sells item */ - int temper1; /* How does keeper react if no money */ - bitvector_t bitvector; /* Can attack? Use bank? Cast here? */ - mob_rnum keeper; /* The mobile who owns the shop (rnum) */ - int with_who; /* Who does the shop trade with? */ - room_vnum *in_room; /* Where is the shop? */ - int open1, open2; /* When does the shop open? */ - int close1, close2; /* When does the shop close? */ - int bankAccount; /* Store all gold over 15000 (disabled) */ - int lastsort; /* How many items are sorted in inven? */ - SPECIAL (*func); /* Secondary spec_proc for shopkeeper */ + room_vnum vnum; /* Virtual number of this shop */ + obj_vnum *producing; /* Which item to produce (virtual) */ + float profit_buy; /* Factor to multiply cost with */ + float profit_sell; /* Factor to multiply cost with */ + struct shop_buy_data *type; /* Which items to trade */ + char *no_such_item1; /* Message if keeper hasn't got an item */ + char *no_such_item2; /* Message if player hasn't got an item */ + char *missing_cash1; /* Message if keeper hasn't got cash */ + char *missing_cash2; /* Message if player hasn't got cash */ + char *do_not_buy; /* If keeper dosn't buy such things */ + char *message_buy; /* Message when player buys item */ + char *message_sell; /* Message when player sells item */ + int temper1; /* How does keeper react if no money */ + bitvector_t bitvector; /* Can attack? Use bank? Cast here? */ + mob_rnum keeper; /* The mobile who owns the shop (rnum) */ + int with_who; /* Who does the shop trade with? */ + room_vnum *in_room; /* Where is the shop? */ + int open1, open2; /* When does the shop open? */ + int close1, close2; /* When does the shop close? */ + int bankAccount; /* Store all gold over 15000 (disabled) */ + int lastsort; /* How many items are sorted in inven? */ + SPECIAL (*func); /* Secondary spec_proc for shopkeeper */ }; -#define MAX_TRADE 5 /* List maximums for compatibility */ -#define MAX_PROD 5 /* with shops before v3.0 */ -#define VERSION3_TAG "v3.0" /* The file has v3.0 shops in it! */ -#define MAX_SHOP_OBJ 100 /* "Soft" maximum for list maximums */ +#define MAX_TRADE 5 /* List maximums for compatibility */ +#define MAX_PROD 5 /* with shops before v3.0 */ +#define VERSION3_TAG "v3.0" /* The file has v3.0 shops in it! */ +#define MAX_SHOP_OBJ 100 /* "Soft" maximum for list maximums */ /* Pretty general macros that could be used elsewhere */ -#define IS_GOD(ch) (!IS_NPC(ch) && (GET_LEVEL(ch) >= LVL_GOD)) -#define END_OF(buffer) ((buffer) + strlen((buffer))) +#define IS_GOD(ch) (!IS_NPC(ch) && (GET_LEVEL(ch) >= LVL_GOD)) +#define END_OF(buffer) ((buffer) + strlen((buffer))) /* Possible states for objects trying to be sold */ -#define OBJECT_DEAD 0 -#define OBJECT_NOTOK 1 -#define OBJECT_OK 2 -#define OBJECT_NOVAL 3 +#define OBJECT_DEAD 0 +#define OBJECT_NOTOK 1 +#define OBJECT_OK 2 +#define OBJECT_NOVAL 3 /* Types of lists to read */ -#define LIST_PRODUCE 0 -#define LIST_TRADE 1 -#define LIST_ROOM 2 +#define LIST_PRODUCE 0 +#define LIST_TRADE 1 +#define LIST_ROOM 2 /* Whom will we not trade with (bitvector for SHOP_TRADE_WITH()) */ #define TRADE_NOGOOD (1 << 0) @@ -85,47 +85,47 @@ struct shop_data { #define NUM_TRADERS 7 struct stack_data { - int data[100]; - int len; + int data[100]; + int len; } ; -#define S_DATA(stack, index) ((stack)->data[(index)]) -#define S_LEN(stack) ((stack)->len) +#define S_DATA(stack, index) ((stack)->data[(index)]) +#define S_LEN(stack) ((stack)->len) /* Which expression type we are now parsing */ -#define OPER_OPEN_PAREN 0 -#define OPER_CLOSE_PAREN 1 -#define OPER_OR 2 -#define OPER_AND 3 -#define OPER_NOT 4 -#define MAX_OPER 4 +#define OPER_OPEN_PAREN 0 +#define OPER_CLOSE_PAREN 1 +#define OPER_OR 2 +#define OPER_AND 3 +#define OPER_NOT 4 +#define MAX_OPER 4 -#define SHOP_NUM(i) (shop_index[(i)].vnum) -#define SHOP_KEEPER(i) (shop_index[(i)].keeper) -#define SHOP_OPEN1(i) (shop_index[(i)].open1) -#define SHOP_CLOSE1(i) (shop_index[(i)].close1) -#define SHOP_OPEN2(i) (shop_index[(i)].open2) -#define SHOP_CLOSE2(i) (shop_index[(i)].close2) -#define SHOP_ROOM(i, num) (shop_index[(i)].in_room[(num)]) -#define SHOP_BUYTYPE(i, num) (BUY_TYPE(shop_index[(i)].type[(num)])) -#define SHOP_BUYWORD(i, num) (BUY_WORD(shop_index[(i)].type[(num)])) -#define SHOP_PRODUCT(i, num) (shop_index[(i)].producing[(num)]) -#define SHOP_BANK(i) (shop_index[(i)].bankAccount) -#define SHOP_BROKE_TEMPER(i) (shop_index[(i)].temper1) -#define SHOP_BITVECTOR(i) (shop_index[(i)].bitvector) -#define SHOP_TRADE_WITH(i) (shop_index[(i)].with_who) -#define SHOP_SORT(i) (shop_index[(i)].lastsort) -#define SHOP_BUYPROFIT(i) (shop_index[(i)].profit_buy) -#define SHOP_SELLPROFIT(i) (shop_index[(i)].profit_sell) -#define SHOP_FUNC(i) (shop_index[(i)].func) +#define SHOP_NUM(i) (shop_index[(i)].vnum) +#define SHOP_KEEPER(i) (shop_index[(i)].keeper) +#define SHOP_OPEN1(i) (shop_index[(i)].open1) +#define SHOP_CLOSE1(i) (shop_index[(i)].close1) +#define SHOP_OPEN2(i) (shop_index[(i)].open2) +#define SHOP_CLOSE2(i) (shop_index[(i)].close2) +#define SHOP_ROOM(i, num) (shop_index[(i)].in_room[(num)]) +#define SHOP_BUYTYPE(i, num) (BUY_TYPE(shop_index[(i)].type[(num)])) +#define SHOP_BUYWORD(i, num) (BUY_WORD(shop_index[(i)].type[(num)])) +#define SHOP_PRODUCT(i, num) (shop_index[(i)].producing[(num)]) +#define SHOP_BANK(i) (shop_index[(i)].bankAccount) +#define SHOP_BROKE_TEMPER(i) (shop_index[(i)].temper1) +#define SHOP_BITVECTOR(i) (shop_index[(i)].bitvector) +#define SHOP_TRADE_WITH(i) (shop_index[(i)].with_who) +#define SHOP_SORT(i) (shop_index[(i)].lastsort) +#define SHOP_BUYPROFIT(i) (shop_index[(i)].profit_buy) +#define SHOP_SELLPROFIT(i) (shop_index[(i)].profit_sell) +#define SHOP_FUNC(i) (shop_index[(i)].func) -#define NOTRADE_GOOD(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOGOOD)) -#define NOTRADE_EVIL(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOEVIL)) -#define NOTRADE_NEUTRAL(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NONEUTRAL)) -#define NOTRADE_MAGIC_USER(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOMAGIC_USER)) -#define NOTRADE_CLERIC(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOCLERIC)) -#define NOTRADE_THIEF(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOTHIEF)) -#define NOTRADE_WARRIOR(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOWARRIOR)) +#define NOTRADE_GOOD(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOGOOD)) +#define NOTRADE_EVIL(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOEVIL)) +#define NOTRADE_NEUTRAL(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NONEUTRAL)) +#define NOTRADE_MAGIC_USER(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOMAGIC_USER)) +#define NOTRADE_CLERIC(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOCLERIC)) +#define NOTRADE_THIEF(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOTHIEF)) +#define NOTRADE_WARRIOR(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOWARRIOR)) /* Shop flags */ #define WILL_START_FIGHT (1 << 0) @@ -134,21 +134,21 @@ struct stack_data { /** Total number of shop flags */ #define NUM_SHOP_FLAGS 3 -#define SHOP_KILL_CHARS(i) (IS_SET(SHOP_BITVECTOR(i), WILL_START_FIGHT)) -#define SHOP_USES_BANK(i) (IS_SET(SHOP_BITVECTOR(i), WILL_BANK_MONEY)) +#define SHOP_KILL_CHARS(i) (IS_SET(SHOP_BITVECTOR(i), WILL_START_FIGHT)) +#define SHOP_USES_BANK(i) (IS_SET(SHOP_BITVECTOR(i), WILL_BANK_MONEY)) -#define MIN_OUTSIDE_BANK 5000 -#define MAX_OUTSIDE_BANK 15000 +#define MIN_OUTSIDE_BANK 5000 +#define MAX_OUTSIDE_BANK 15000 -#define MSG_NOT_OPEN_YET "Come back later!" -#define MSG_NOT_REOPEN_YET "Sorry, we have closed, but come back later." -#define MSG_CLOSED_FOR_DAY "Sorry, come back tomorrow." -#define MSG_NO_STEAL_HERE "$n is a bloody thief!" -#define MSG_NO_SEE_CHAR "I don't trade with someone I can't see!" -#define MSG_NO_SELL_ALIGN "Get out of here before I call the guards!" -#define MSG_NO_SELL_CLASS "We don't serve your kind here!" -#define MSG_NO_USED_WANDSTAFF "I don't buy used up wands or staves!" -#define MSG_CANT_KILL_KEEPER "Get out of here before I call the guards!" +#define MSG_NOT_OPEN_YET "Come back later!" +#define MSG_NOT_REOPEN_YET "Sorry, we have closed, but come back later." +#define MSG_CLOSED_FOR_DAY "Sorry, come back tomorrow." +#define MSG_NO_STEAL_HERE "$n is a bloody thief!" +#define MSG_NO_SEE_CHAR "I don't trade with someone I can't see!" +#define MSG_NO_SELL_ALIGN "Get out of here before I call the guards!" +#define MSG_NO_SELL_CLASS "We don't serve your kind here!" +#define MSG_NO_USED_WANDSTAFF "I don't buy used up wands or staves!" +#define MSG_CANT_KILL_KEEPER "Get out of here before I call the guards!" /* Global variables */ diff --git a/src/spec_procs.h b/src/spec_procs.h index 722b88e..3bb8bd7 100644 --- a/src/spec_procs.h +++ b/src/spec_procs.h @@ -2,25 +2,25 @@ * @file spec_procs.h * Header file for special procedure modules. This file groups a lot of the * legacy special procedures found in spec_procs.c and castle.c. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. -* +* */ #ifndef _SPEC_PROCS_H_ #define _SPEC_PROCS_H_ /***************************************************************************** - * Begin Functions and defines for castle.c + * Begin Functions and defines for castle.c ****************************************************************************/ void assign_kings_castle(void); /***************************************************************************** - * Begin Functions and defines for spec_assign.c + * Begin Functions and defines for spec_assign.c ****************************************************************************/ void assign_mobiles(void); void assign_objects(void); @@ -30,7 +30,7 @@ void assign_rooms(void); const char *get_spec_func_name(SPECIAL(*func)); /***************************************************************************** - * Begin Functions and defines for spec_procs.c + * Begin Functions and defines for spec_procs.c ****************************************************************************/ /* Utility functions */ void sort_spells(void); diff --git a/src/spells.h b/src/spells.h index 4bcb8ec..805544b 100644 --- a/src/spells.h +++ b/src/spells.h @@ -12,28 +12,28 @@ #ifndef _SPELLS_H_ #define _SPELLS_H_ -#define DEFAULT_STAFF_LVL 12 -#define DEFAULT_WAND_LVL 12 +#define DEFAULT_STAFF_LVL 12 +#define DEFAULT_WAND_LVL 12 -#define CAST_UNDEFINED (-1) -#define CAST_SPELL 0 -#define CAST_POTION 1 -#define CAST_WAND 2 -#define CAST_STAFF 3 -#define CAST_SCROLL 4 +#define CAST_UNDEFINED (-1) +#define CAST_SPELL 0 +#define CAST_POTION 1 +#define CAST_WAND 2 +#define CAST_STAFF 3 +#define CAST_SCROLL 4 -#define MAG_DAMAGE (1 << 0) -#define MAG_AFFECTS (1 << 1) -#define MAG_UNAFFECTS (1 << 2) -#define MAG_POINTS (1 << 3) -#define MAG_ALTER_OBJS (1 << 4) -#define MAG_GROUPS (1 << 5) -#define MAG_MASSES (1 << 6) -#define MAG_AREAS (1 << 7) -#define MAG_SUMMONS (1 << 8) -#define MAG_CREATIONS (1 << 9) -#define MAG_MANUAL (1 << 10) -#define MAG_ROOMS (1 << 11) +#define MAG_DAMAGE (1 << 0) +#define MAG_AFFECTS (1 << 1) +#define MAG_UNAFFECTS (1 << 2) +#define MAG_POINTS (1 << 3) +#define MAG_ALTER_OBJS (1 << 4) +#define MAG_GROUPS (1 << 5) +#define MAG_MASSES (1 << 6) +#define MAG_AREAS (1 << 7) +#define MAG_SUMMONS (1 << 8) +#define MAG_CREATIONS (1 << 9) +#define MAG_MANUAL (1 << 10) +#define MAG_ROOMS (1 << 11) #define TYPE_UNDEFINED (-1) #define SPELL_RESERVED_DBC 0 /* SKILL NUMBER ZERO -- RESERVED */ @@ -97,7 +97,7 @@ #define NUM_SPELLS 54 /* Insert new spells here, up to MAX_SPELLS */ -#define MAX_SPELLS 130 +#define MAX_SPELLS 130 /* PLAYER SKILLS - Numbered from MAX_SPELLS+1 to MAX_SKILLS */ #define SKILL_BACKSTAB 131 /* Reserved Skill[] DO NOT CHANGE */ @@ -105,7 +105,7 @@ #define SKILL_HIDE 133 /* Reserved Skill[] DO NOT CHANGE */ #define SKILL_KICK 134 /* Reserved Skill[] DO NOT CHANGE */ #define SKILL_PICK_LOCK 135 /* Reserved Skill[] DO NOT CHANGE */ -#define SKILL_WHIRLWIND 136 +#define SKILL_WHIRLWIND 136 #define SKILL_RESCUE 137 /* Reserved Skill[] DO NOT CHANGE */ #define SKILL_SNEAK 138 /* Reserved Skill[] DO NOT CHANGE */ #define SKILL_STEAL 139 /* Reserved Skill[] DO NOT CHANGE */ @@ -124,7 +124,7 @@ * define it with a 'spellname'. */ #define SPELL_DG_AFFECT 298 -#define TOP_SPELL_DEFINE 299 +#define TOP_SPELL_DEFINE 299 /* NEW NPC/OBJECT SPELLS can be inserted here up to 299 */ /* WEAPON ATTACK TYPES */ @@ -140,14 +140,14 @@ #define TYPE_MAUL 309 #define TYPE_THRASH 310 #define TYPE_PIERCE 311 -#define TYPE_BLAST 312 -#define TYPE_PUNCH 313 -#define TYPE_STAB 314 +#define TYPE_BLAST 312 +#define TYPE_PUNCH 313 +#define TYPE_STAB 314 /** The total number of attack types */ #define NUM_ATTACK_TYPES 15 /* new attack types can be added here - up to TYPE_SUFFERING */ -#define TYPE_SUFFERING 399 +#define TYPE_SUFFERING 399 #define SAVING_PARA 0 #define SAVING_ROD 1 @@ -175,24 +175,24 @@ #define TAR_FIGHT_SELF (1 << 3) #define TAR_FIGHT_VICT (1 << 4) #define TAR_SELF_ONLY (1 << 5) /* Only a check, use with i.e. TAR_CHAR_ROOM */ -#define TAR_NOT_SELF (1 << 6) /* Only a check, use with i.e. TAR_CHAR_ROOM */ +#define TAR_NOT_SELF (1 << 6) /* Only a check, use with i.e. TAR_CHAR_ROOM */ #define TAR_OBJ_INV (1 << 7) #define TAR_OBJ_ROOM (1 << 8) #define TAR_OBJ_WORLD (1 << 9) -#define TAR_OBJ_EQUIP (1 << 10) +#define TAR_OBJ_EQUIP (1 << 10) struct spell_info_type { - byte min_position; /* Position for caster */ - int mana_min; /* Min amount of mana used by a spell (highest lev) */ - int mana_max; /* Max amount of mana used by a spell (lowest lev) */ - int mana_change; /* Change in mana used by spell from lev to lev */ + byte min_position; /* Position for caster */ + int mana_min; /* Min amount of mana used by a spell (highest lev) */ + int mana_max; /* Max amount of mana used by a spell (lowest lev) */ + int mana_change; /* Change in mana used by spell from lev to lev */ - int min_level[NUM_CLASSES]; - int routines; - byte violent; - int targets; /* See below for use with TAR_XXX */ - const char *name; /* Input size not limited. Originates from string constants. */ - const char *wear_off_msg; /* Input size not limited. Originates from string constants. */ + int min_level[NUM_CLASSES]; + int routines; + byte violent; + int targets; /* See below for use with TAR_XXX */ + const char *name; /* Input size not limited. Originates from string constants. */ + const char *wear_off_msg; /* Input size not limited. Originates from string constants. */ }; /* Possible Targets: @@ -212,11 +212,9 @@ struct spell_info_type { #define SPELL_TYPE_STAFF 3 #define SPELL_TYPE_SCROLL 4 -#define ASPELL(spellname) \ -void spellname(int level, struct char_data *ch, \ - struct char_data *victim, struct obj_data *obj) +#define ASPELL(spellname) void spellname(int level, struct char_data *ch, struct char_data *victim, struct obj_data *obj) -#define MANUAL_SPELL(spellname) spellname(level, caster, cvict, ovict); +#define MANUAL_SPELL(spellname) spellname(level, caster, cvict, ovict); ASPELL(spell_create_water); ASPELL(spell_recall); @@ -233,11 +231,9 @@ ASPELL(spell_detect_poison); int find_skill_num(char *name); -int mag_damage(int level, struct char_data *ch, struct char_data *victim, - int spellnum, int savetype); +int mag_damage(int level, struct char_data *ch, struct char_data *victim, int spellnum, int savetype); -void mag_affects(int level, struct char_data *ch, struct char_data *victim, - int spellnum, int savetype); +void mag_affects(int level, struct char_data *ch, struct char_data *victim, int spellnum, int savetype); void mag_groups(int level, struct char_data *ch, int spellnum, int savetype); @@ -247,28 +243,21 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype); void mag_rooms(int level, struct char_data *ch, int spellnum); -void mag_summons(int level, struct char_data *ch, struct obj_data *obj, - int spellnum, int savetype); +void mag_summons(int level, struct char_data *ch, struct obj_data *obj, int spellnum, int savetype); -void mag_points(int level, struct char_data *ch, struct char_data *victim, - int spellnum, int savetype); +void mag_points(int level, struct char_data *ch, struct char_data *victim, int spellnum, int savetype); -void mag_unaffects(int level, struct char_data *ch, struct char_data *victim, - int spellnum, int type); +void mag_unaffects(int level, struct char_data *ch, struct char_data *victim, int spellnum, int type); -void mag_alter_objs(int level, struct char_data *ch, struct obj_data *obj, - int spellnum, int type); +void mag_alter_objs(int level, struct char_data *ch, struct obj_data *obj, int spellnum, int type); void mag_creations(int level, struct char_data *ch, int spellnum); -int call_magic(struct char_data *caster, struct char_data *cvict, - struct obj_data *ovict, int spellnum, int level, int casttype); +int call_magic(struct char_data *caster, struct char_data *cvict, struct obj_data *ovict, int spellnum, int level, int casttype); -void mag_objectmagic(struct char_data *ch, struct obj_data *obj, - char *argument); +void mag_objectmagic(struct char_data *ch, struct obj_data *obj, char *argument); -int cast_spell(struct char_data *ch, struct char_data *tch, - struct obj_data *tobj, int spellnum); +int cast_spell(struct char_data *ch, struct char_data *tch, struct obj_data *tobj, int spellnum); /* other prototypes */ void spell_level(int spell, int chclass, int level); diff --git a/src/structs.h b/src/structs.h index 08e47db..4a476b2 100644 --- a/src/structs.h +++ b/src/structs.h @@ -18,7 +18,7 @@ /** If you want equipment to be automatically equipped to the same place * it was when players rented, set the define below to 1 because * TRUE/FALSE aren't defined yet. */ -#define USE_AUTOEQ 1 +#define USE_AUTOEQ 1 /* preamble */ /** As of bpl20, it should be safe to use unsigned data types for the various @@ -26,29 +26,28 @@ * signed anymore so use the unsigned types and get 65,535 objects instead of * 32,768. NOTE: This will likely be unconditionally unsigned later. * 0 = use signed indexes; 1 = use unsigned indexes */ -#define CIRCLE_UNSIGNED_INDEX 1 +#define CIRCLE_UNSIGNED_INDEX 1 #if CIRCLE_UNSIGNED_INDEX -# define IDXTYPE ush_int /**< Index types are unsigned short ints */ -# define IDXTYPE_MAX USHRT_MAX /**< Used for compatibility checks. */ -# define IDXTYPE_MIN 0 /**< Used for compatibility checks. */ -# define NOWHERE ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ -# define NOTHING ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ -# define NOBODY ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ -# define NOFLAG ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ +# define IDXTYPE ush_int /**< Index types are unsigned short ints */ +# define IDXTYPE_MAX USHRT_MAX /**< Used for compatibility checks. */ +# define IDXTYPE_MIN 0 /**< Used for compatibility checks. */ +# define NOWHERE ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ +# define NOTHING ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ +# define NOBODY ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ +# define NOFLAG ((IDXTYPE)~0) /**< Sets to ush_int_MAX, or 65,535 */ #else -# define IDXTYPE sh_int /**< Index types are unsigned short ints */ -# define IDXTYPE_MAX SHRT_MAX /**< Used for compatibility checks. */ -# define IDXTYPE_MIN SHRT_MIN /**< Used for compatibility checks. */ -# define NOWHERE ((IDXTYPE)-1) /**< nil reference for rooms */ -# define NOTHING ((IDXTYPE)-1) /**< nil reference for objects */ -# define NOBODY ((IDXTYPE)-1) /**< nil reference for mobiles */ -# define NOFLAG ((IDXTYPE)-1) /**< nil reference for flags */ +# define IDXTYPE sh_int /**< Index types are unsigned short ints */ +# define IDXTYPE_MAX SHRT_MAX /**< Used for compatibility checks. */ +# define IDXTYPE_MIN SHRT_MIN /**< Used for compatibility checks. */ +# define NOWHERE ((IDXTYPE)-1) /**< nil reference for rooms */ +# define NOTHING ((IDXTYPE)-1) /**< nil reference for objects */ +# define NOBODY ((IDXTYPE)-1) /**< nil reference for mobiles */ +# define NOFLAG ((IDXTYPE)-1) /**< nil reference for flags */ #endif /** Function macro for the mob, obj and room special functions */ -#define SPECIAL(name) \ - int (name)(struct char_data *ch, void *me, int cmd, char *argument) +#define SPECIAL(name) int (name)(struct char_data *ch, void *me, int cmd, char *argument) /* room-related defines */ /* The cardinal directions: used as index to room_data.dir_option[] */ @@ -74,11 +73,11 @@ #define ROOM_DEATH 1 /**< Death trap, instant death */ #define ROOM_NOMOB 2 /**< MOBs not allowed in room */ #define ROOM_INDOORS 3 /**< Indoors, no weather */ -#define ROOM_PEACEFUL 4 /**< Violence not allowed */ +#define ROOM_PEACEFUL 4 /**< Violence not allowed */ #define ROOM_SOUNDPROOF 5 /**< Shouts, gossip blocked */ #define ROOM_NOTRACK 6 /**< Track won't go through */ #define ROOM_NOMAGIC 7 /**< Magic not allowed */ -#define ROOM_TUNNEL 8 /**< Room for only 1 pers */ +#define ROOM_TUNNEL 8 /**< Room for only 1 pers */ #define ROOM_PRIVATE 9 /**< Can't teleport in */ #define ROOM_GODROOM 10 /**< LVL_GOD+ only allowed */ #define ROOM_HOUSE 11 /**< (R) Room is a house */ @@ -88,7 +87,7 @@ #define ROOM_BFS_MARK 15 /**< (R) breath-first srch mrk */ #define ROOM_WORLDMAP 16 /**< World-map style maps here */ /** The total number of Room Flags */ -#define NUM_ROOM_FLAGS 17 +#define NUM_ROOM_FLAGS 17 /* Zone info: Used in zone_data.zone_flags */ #define ZONE_CLOSED 0 /**< Zone is closed - players cannot enter */ @@ -109,16 +108,16 @@ #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. */ -#define SECT_CITY 1 /**< In a city */ -#define SECT_FIELD 2 /**< In a field */ -#define SECT_FOREST 3 /**< In a forest */ -#define SECT_HILLS 4 /**< In the hills */ -#define SECT_MOUNTAIN 5 /**< On a mountain */ -#define SECT_WATER_SWIM 6 /**< Swimmable water */ -#define SECT_WATER_NOSWIM 7 /**< Water - need a boat */ -#define SECT_FLYING 8 /**< Flying */ -#define SECT_UNDERWATER 9 /**< Underwater */ +#define SECT_INSIDE 0 /**< Indoors, connected to SECT macro. */ +#define SECT_CITY 1 /**< In a city */ +#define SECT_FIELD 2 /**< In a field */ +#define SECT_FOREST 3 /**< In a forest */ +#define SECT_HILLS 4 /**< In the hills */ +#define SECT_MOUNTAIN 5 /**< On a mountain */ +#define SECT_WATER_SWIM 6 /**< Swimmable water */ +#define SECT_WATER_NOSWIM 7 /**< Water - need a boat */ +#define SECT_FLYING 8 /**< Flying */ +#define SECT_UNDERWATER 9 /**< Underwater */ /** The total number of room Sector Types */ #define NUM_ROOM_SECTORS 10 @@ -145,13 +144,13 @@ #define GROUP_NPC (1 << 2) /**< Group created by NPC and thus not listed */ /* PC classes */ -#define CLASS_UNDEFINED (-1) /**< PC Class undefined */ +#define CLASS_UNDEFINED (-1) /**< PC Class undefined */ #define CLASS_MAGIC_USER 0 /**< PC Class Magic User */ #define CLASS_CLERIC 1 /**< PC Class Cleric */ #define CLASS_THIEF 2 /**< PC Class Thief */ #define CLASS_WARRIOR 3 /**< PC Class Warrior */ /** Total number of available PC Classes */ -#define NUM_CLASSES 4 +#define NUM_CLASSES 4 /* NPC classes (currently unused - feel free to implement!) */ #define CLASS_OTHER 0 /**< NPC Class Other (or undefined) */ @@ -169,17 +168,17 @@ #define NUM_GENDERS 3 /* Positions */ -#define POS_DEAD 0 /**< Position = dead */ -#define POS_MORTALLYW 1 /**< Position = mortally wounded */ -#define POS_INCAP 2 /**< Position = incapacitated */ -#define POS_STUNNED 3 /**< Position = stunned */ -#define POS_SLEEPING 4 /**< Position = sleeping */ -#define POS_RESTING 5 /**< Position = resting */ -#define POS_SITTING 6 /**< Position = sitting */ -#define POS_FIGHTING 7 /**< Position = fighting */ -#define POS_STANDING 8 /**< Position = standing */ +#define POS_DEAD 0 /**< Position = dead */ +#define POS_MORTALLYW 1 /**< Position = mortally wounded */ +#define POS_INCAP 2 /**< Position = incapacitated */ +#define POS_STUNNED 3 /**< Position = stunned */ +#define POS_SLEEPING 4 /**< Position = sleeping */ +#define POS_RESTING 5 /**< Position = resting */ +#define POS_SITTING 6 /**< Position = sitting */ +#define POS_FIGHTING 7 /**< Position = fighting */ +#define POS_STANDING 8 /**< Position = standing */ /** Total number of positions. */ -#define NUM_POSITIONS 9 +#define NUM_POSITIONS 9 /* Player flags: used by char_data.char_specials.act */ #define PLR_KILLER 0 /**< Player is a player-killer */ @@ -208,7 +207,7 @@ #define MOB_SENTINEL 1 /**< Mob should not move */ #define MOB_SCAVENGER 2 /**< Mob picks up stuff on the ground */ #define MOB_ISNPC 3 /**< (R) Automatically set on all Mobs */ -#define MOB_AWARE 4 /**< Mob can't be backstabbed */ +#define MOB_AWARE 4 /**< Mob can't be backstabbed */ #define MOB_AGGRESSIVE 5 /**< Mob auto-attacks everybody nearby */ #define MOB_STAY_ZONE 6 /**< Mob shouldn't wander out of zone */ #define MOB_WIMPY 7 /**< Mob flees if severely injured */ @@ -294,9 +293,9 @@ /** Total number of affect flags */ #define NUM_AFF_FLAGS 23 -/* Modes of connectedness: used by descriptor_data.state */ -#define CON_PLAYING 0 /**< Playing - Nominal state */ -#define CON_CLOSE 1 /**< User disconnect, remove character. */ +/* Modes of connectedness: used by descriptor_data.state */ +#define CON_PLAYING 0 /**< Playing - Nominal state */ +#define CON_CLOSE 1 /**< User disconnect, remove character. */ #define CON_GET_NAME 2 /**< Login with name */ #define CON_NAME_CNFRM 3 /**< New character, confirm name */ #define CON_PASSWORD 4 /**< Login with password */ @@ -307,19 +306,19 @@ #define CON_RMOTD 9 /**< Reading the message of the day */ #define CON_MENU 10 /**< At the main menu */ #define CON_PLR_DESC 11 /**< Enter a new character description prompt */ -#define CON_CHPWD_GETOLD 12 /**< Changing passwd: Get old */ +#define CON_CHPWD_GETOLD 12 /**< Changing passwd: Get old */ #define CON_CHPWD_GETNEW 13 /**< Changing passwd: Get new */ #define CON_CHPWD_VRFY 14 /**< Changing passwd: Verify new password */ -#define CON_DELCNF1 15 /**< Character Delete: Confirmation 1 */ -#define CON_DELCNF2 16 /**< Character Delete: Confirmation 2 */ -#define CON_DISCONNECT 17 /**< In-game link loss (leave character) */ -#define CON_OEDIT 18 /**< OLC mode - object editor */ -#define CON_REDIT 19 /**< OLC mode - room editor */ -#define CON_ZEDIT 20 /**< OLC mode - zone info editor */ -#define CON_MEDIT 21 /**< OLC mode - mobile editor */ -#define CON_SEDIT 22 /**< OLC mode - shop editor */ -#define CON_TEDIT 23 /**< OLC mode - text editor */ -#define CON_CEDIT 24 /**< OLC mode - conf editor */ +#define CON_DELCNF1 15 /**< Character Delete: Confirmation 1 */ +#define CON_DELCNF2 16 /**< Character Delete: Confirmation 2 */ +#define CON_DISCONNECT 17 /**< In-game link loss (leave character) */ +#define CON_OEDIT 18 /**< OLC mode - object editor */ +#define CON_REDIT 19 /**< OLC mode - room editor */ +#define CON_ZEDIT 20 /**< OLC mode - zone info editor */ +#define CON_MEDIT 21 /**< OLC mode - mobile editor */ +#define CON_SEDIT 22 /**< OLC mode - shop editor */ +#define CON_TEDIT 23 /**< OLC mode - text editor */ +#define CON_CEDIT 24 /**< OLC mode - conf editor */ #define CON_AEDIT 25 /**< OLC mode - social (action) edit */ #define CON_TRIGEDIT 26 /**< OLC mode - trigger edit */ #define CON_HEDIT 27 /**< OLC mode - help edit */ @@ -361,29 +360,29 @@ /* object-related defines */ /* Item types: used by obj_data.obj_flags.type_flag */ -#define ITEM_LIGHT 1 /**< Item is a light source */ -#define ITEM_SCROLL 2 /**< Item is a scroll */ -#define ITEM_WAND 3 /**< Item is a wand */ -#define ITEM_STAFF 4 /**< Item is a staff */ -#define ITEM_WEAPON 5 /**< Item is a weapon */ -#define ITEM_FURNITURE 6 /**< Sittable Furniture */ -#define ITEM_FREE 7 /**< Unimplemented */ -#define ITEM_TREASURE 8 /**< Item is a treasure, not gold */ -#define ITEM_ARMOR 9 /**< Item is armor */ -#define ITEM_POTION 10 /**< Item is a potion */ -#define ITEM_WORN 11 /**< Unimplemented */ -#define ITEM_OTHER 12 /**< Misc object */ -#define ITEM_TRASH 13 /**< Trash - shopkeepers won't buy */ -#define ITEM_FREE2 14 /**< Unimplemented */ -#define ITEM_CONTAINER 15 /**< Item is a container */ -#define ITEM_NOTE 16 /**< Item is note */ -#define ITEM_DRINKCON 17 /**< Item is a drink container */ -#define ITEM_KEY 18 /**< Item is a key */ -#define ITEM_FOOD 19 /**< Item is food */ -#define ITEM_MONEY 20 /**< Item is money (gold) */ -#define ITEM_PEN 21 /**< Item is a pen */ -#define ITEM_BOAT 22 /**< Item is a boat */ -#define ITEM_FOUNTAIN 23 /**< Item is a fountain */ +#define ITEM_LIGHT 1 /**< Item is a light source */ +#define ITEM_SCROLL 2 /**< Item is a scroll */ +#define ITEM_WAND 3 /**< Item is a wand */ +#define ITEM_STAFF 4 /**< Item is a staff */ +#define ITEM_WEAPON 5 /**< Item is a weapon */ +#define ITEM_FURNITURE 6 /**< Sittable Furniture */ +#define ITEM_FREE 7 /**< Unimplemented */ +#define ITEM_TREASURE 8 /**< Item is a treasure, not gold */ +#define ITEM_ARMOR 9 /**< Item is armor */ +#define ITEM_POTION 10 /**< Item is a potion */ +#define ITEM_WORN 11 /**< Unimplemented */ +#define ITEM_OTHER 12 /**< Misc object */ +#define ITEM_TRASH 13 /**< Trash - shopkeepers won't buy */ +#define ITEM_FREE2 14 /**< Unimplemented */ +#define ITEM_CONTAINER 15 /**< Item is a container */ +#define ITEM_NOTE 16 /**< Item is note */ +#define ITEM_DRINKCON 17 /**< Item is a drink container */ +#define ITEM_KEY 18 /**< Item is a key */ +#define ITEM_FOOD 19 /**< Item is food */ +#define ITEM_MONEY 20 /**< Item is money (gold) */ +#define ITEM_PEN 21 /**< Item is a pen */ +#define ITEM_BOAT 22 /**< Item is a boat */ +#define ITEM_FOUNTAIN 23 /**< Item is a fountain */ /** Total number of item types.*/ #define NUM_ITEM_TYPES 24 @@ -395,13 +394,13 @@ #define ITEM_WEAR_HEAD 4 /**< Item can be worn on head */ #define ITEM_WEAR_LEGS 5 /**< Item can be worn on legs */ #define ITEM_WEAR_FEET 6 /**< Item can be worn on feet */ -#define ITEM_WEAR_HANDS 7 /**< Item can be worn on hands */ +#define ITEM_WEAR_HANDS 7 /**< Item can be worn on hands */ #define ITEM_WEAR_ARMS 8 /**< Item can be worn on arms */ #define ITEM_WEAR_SHIELD 9 /**< Item can be used as a shield */ -#define ITEM_WEAR_ABOUT 10 /**< Item can be worn about body */ +#define ITEM_WEAR_ABOUT 10 /**< Item can be worn about body */ #define ITEM_WEAR_WAIST 11 /**< Item can be worn around waist */ -#define ITEM_WEAR_WRIST 12 /**< Item can be worn on wrist */ -#define ITEM_WEAR_WIELD 13 /**< Item can be wielded */ +#define ITEM_WEAR_WRIST 12 /**< Item can be worn on wrist */ +#define ITEM_WEAR_WIELD 13 /**< Item can be wielded */ #define ITEM_WEAR_HOLD 14 /**< Item can be held */ /** Total number of item wears */ #define NUM_ITEM_WEARS 15 @@ -411,60 +410,60 @@ #define ITEM_HUM 1 /**< Item is humming */ #define ITEM_NORENT 2 /**< Item cannot be rented */ #define ITEM_NODONATE 3 /**< Item cannot be donated */ -#define ITEM_NOINVIS 4 /**< Item cannot be made invis */ +#define ITEM_NOINVIS 4 /**< Item cannot be made invis */ #define ITEM_INVISIBLE 5 /**< Item is invisible */ #define ITEM_MAGIC 6 /**< Item is magical */ #define ITEM_NODROP 7 /**< Item is cursed: can't drop */ #define ITEM_BLESS 8 /**< Item is blessed */ -#define ITEM_ANTI_GOOD 9 /**< Not usable by good people */ -#define ITEM_ANTI_EVIL 10 /**< Not usable by evil people */ +#define ITEM_ANTI_GOOD 9 /**< Not usable by good people */ +#define ITEM_ANTI_EVIL 10 /**< Not usable by evil people */ #define ITEM_ANTI_NEUTRAL 11 /**< Not usable by neutral people */ #define ITEM_ANTI_MAGIC_USER 12 /**< Not usable by mages */ #define ITEM_ANTI_CLERIC 13 /**< Not usable by clerics */ -#define ITEM_ANTI_THIEF 14 /**< Not usable by thieves */ +#define ITEM_ANTI_THIEF 14 /**< Not usable by thieves */ #define ITEM_ANTI_WARRIOR 15 /**< Not usable by warriors */ #define ITEM_NOSELL 16 /**< Shopkeepers won't touch it */ #define ITEM_QUEST 17 /**< Item is a quest item */ /** Total number of item flags */ -#define NUM_ITEM_FLAGS 18 +#define NUM_ITEM_FLAGS 18 /* Modifier constants used with obj affects ('A' fields) */ -#define APPLY_NONE 0 /**< No effect */ -#define APPLY_STR 1 /**< Apply to strength */ -#define APPLY_DEX 2 /**< Apply to dexterity */ -#define APPLY_INT 3 /**< Apply to intelligence */ -#define APPLY_WIS 4 /**< Apply to wisdom */ -#define APPLY_CON 5 /**< Apply to constitution */ -#define APPLY_CHA 6 /**< Apply to charisma */ -#define APPLY_CLASS 7 /**< Reserved */ -#define APPLY_LEVEL 8 /**< Reserved */ -#define APPLY_AGE 9 /**< Apply to age */ -#define APPLY_CHAR_WEIGHT 10 /**< Apply to weight */ -#define APPLY_CHAR_HEIGHT 11 /**< Apply to height */ -#define APPLY_MANA 12 /**< Apply to max mana */ -#define APPLY_HIT 13 /**< Apply to max hit points */ -#define APPLY_MOVE 14 /**< Apply to max move points */ -#define APPLY_GOLD 15 /**< Reserved */ -#define APPLY_EXP 16 /**< Reserved */ -#define APPLY_AC 17 /**< Apply to Armor Class */ -#define APPLY_HITROLL 18 /**< Apply to hitroll */ -#define APPLY_DAMROLL 19 /**< Apply to damage roll */ -#define APPLY_SAVING_PARA 20 /**< Apply to save throw: paralysis */ -#define APPLY_SAVING_ROD 21 /**< Apply to save throw: rods */ -#define APPLY_SAVING_PETRI 22 /**< Apply to save throw: petrif */ -#define APPLY_SAVING_BREATH 23 /**< Apply to save throw: breath */ -#define APPLY_SAVING_SPELL 24 /**< Apply to save throw: spells */ +#define APPLY_NONE 0 /**< No effect */ +#define APPLY_STR 1 /**< Apply to strength */ +#define APPLY_DEX 2 /**< Apply to dexterity */ +#define APPLY_INT 3 /**< Apply to intelligence */ +#define APPLY_WIS 4 /**< Apply to wisdom */ +#define APPLY_CON 5 /**< Apply to constitution */ +#define APPLY_CHA 6 /**< Apply to charisma */ +#define APPLY_CLASS 7 /**< Reserved */ +#define APPLY_LEVEL 8 /**< Reserved */ +#define APPLY_AGE 9 /**< Apply to age */ +#define APPLY_CHAR_WEIGHT 10 /**< Apply to weight */ +#define APPLY_CHAR_HEIGHT 11 /**< Apply to height */ +#define APPLY_MANA 12 /**< Apply to max mana */ +#define APPLY_HIT 13 /**< Apply to max hit points */ +#define APPLY_MOVE 14 /**< Apply to max move points */ +#define APPLY_GOLD 15 /**< Reserved */ +#define APPLY_EXP 16 /**< Reserved */ +#define APPLY_AC 17 /**< Apply to Armor Class */ +#define APPLY_HITROLL 18 /**< Apply to hitroll */ +#define APPLY_DAMROLL 19 /**< Apply to damage roll */ +#define APPLY_SAVING_PARA 20 /**< Apply to save throw: paralysis */ +#define APPLY_SAVING_ROD 21 /**< Apply to save throw: rods */ +#define APPLY_SAVING_PETRI 22 /**< Apply to save throw: petrif */ +#define APPLY_SAVING_BREATH 23 /**< Apply to save throw: breath */ +#define APPLY_SAVING_SPELL 24 /**< Apply to save throw: spells */ /** Total number of applies */ -#define NUM_APPLIES 25 +#define NUM_APPLIES 25 /* Equals the total number of SAVING_* defines in spells.h */ -#define NUM_OF_SAVING_THROWS 5 +#define NUM_OF_SAVING_THROWS 5 /* Container flags - value[1] */ -#define CONT_CLOSEABLE (1 << 0) /**< Container can be closed */ -#define CONT_PICKPROOF (1 << 1) /**< Container is pickproof */ -#define CONT_CLOSED (1 << 2) /**< Container is closed */ -#define CONT_LOCKED (1 << 3) /**< Container is locked */ +#define CONT_CLOSEABLE (1 << 0) /**< Container can be closed */ +#define CONT_PICKPROOF (1 << 1) /**< Container is pickproof */ +#define CONT_CLOSED (1 << 2) /**< Container is closed */ +#define CONT_LOCKED (1 << 3) /**< Container is locked */ /* Some different kind of liquids for use in values of drink containers */ #define LIQ_WATER 0 /**< Liquid type water */ @@ -484,7 +483,7 @@ #define LIQ_SALTWATER 14 /**< Liquid type saltwater */ #define LIQ_CLEARWATER 15 /**< Liquid type clearwater */ /** Total number of liquid types */ -#define NUM_LIQ_TYPES 16 +#define NUM_LIQ_TYPES 16 /* other miscellaneous defines */ /* Player conditions */ @@ -493,10 +492,10 @@ #define THIRST 2 /**< Player thirst condition */ /* Sun state for weather_data */ -#define SUN_DARK 0 /**< Night time */ -#define SUN_RISE 1 /**< Dawn */ -#define SUN_LIGHT 2 /**< Day time */ -#define SUN_SET 3 /**< Dusk */ +#define SUN_DARK 0 /**< Night time */ +#define SUN_RISE 1 /**< Dawn */ +#define SUN_LIGHT 2 /**< Day time */ +#define SUN_SET 3 /**< Dusk */ /* Sky conditions for weather_data */ #define SKY_CLOUDLESS 0 /**< Weather = No clouds */ @@ -532,13 +531,13 @@ #define LVL_IMPL 34 /**< Level of Implementors */ #define LVL_GRGOD 33 /**< Level of Greater Gods */ #define LVL_GOD 32 /**< Level of Gods */ -#define LVL_IMMORT 31 /**< Level of Immortals */ +#define LVL_IMMORT 31 /**< Level of Immortals */ /** Minimum level to build and to run the saveall command */ -#define LVL_BUILDER LVL_IMMORT +#define LVL_BUILDER LVL_IMMORT /** Arbitrary number that won't be in a string */ -#define MAGIC_NUMBER (0x06) +#define MAGIC_NUMBER (0x06) /** OPT_USEC determines how many commands will be processed by the MUD per * second and how frequently it does socket I/O. A low setting will cause @@ -550,18 +549,18 @@ * @see PASSES_PER_SEC * @see RL_SEC */ -#define OPT_USEC 100000 +#define OPT_USEC 100000 /** How many heartbeats equate to one real second. * @see OPT_USEC * @see RL_SEC */ -#define PASSES_PER_SEC (1000000 / OPT_USEC) +#define PASSES_PER_SEC (1000000 / OPT_USEC) /** Used with other macros to define at how many heartbeats a control loop * gets executed. Helps to translate pulse counts to real seconds for * human comprehension. * @see PASSES_PER_SEC */ -#define RL_SEC * PASSES_PER_SEC +#define RL_SEC * PASSES_PER_SEC /** Controls when a zone update will occur. */ #define PULSE_ZONE (10 RL_SEC) @@ -583,7 +582,7 @@ #define PULSE_USAGE (5 * 60 RL_SEC) /** Controls when to save the current ingame MUD time to disk. * This should be set >= SECS_PER_MUD_HOUR */ -#define PULSE_TIMESAVE (30 * 60 RL_SEC) +#define PULSE_TIMESAVE (30 * 60 RL_SEC) /* Variables for the output buffering system */ #define MAX_SOCK_BUF (24 * 1024) /**< Size of kernel's sock buf */ #define MAX_PROMPT_LENGTH 96 /**< Max length of prompt */ @@ -622,11 +621,11 @@ typedef signed char sbyte; /**< 1 byte; vals = -127 to 127 */ typedef unsigned char ubyte; /**< 1 byte; vals = 0 to 255 */ typedef signed short int sh_int; /**< 2 bytes; vals = -32,768 to 32,767 */ typedef unsigned short int ush_int; /**< 2 bytes; vals = 0 to 65,535 */ -#if !defined(__cplusplus) /* Anyone know a portable method? */ +#if !defined(__cplusplus) /* Anyone know a portable method? */ typedef char bool; /**< Technically 1 signed byte; vals should only = TRUE or FALSE. */ #endif -#if !defined(CIRCLE_WINDOWS) || defined(LCC_WIN32) /* Hm, sysdep.h? */ +#if !defined(CIRCLE_WINDOWS) || defined(LCC_WIN32) /* Hm, sysdep.h? */ typedef signed char byte; /**< Technically 1 signed byte; vals should only = TRUE or FALSE. */ #endif @@ -659,11 +658,10 @@ typedef unsigned long int bitvector_t; * the mob, object or room. * Multiple extra descriptions on the same object are implemented as a * linked list. */ -struct extra_descr_data -{ - char *keyword; /**< Keyword for look/examine */ - char *description; /**< What is shown when this keyword is 'seen' */ - struct extra_descr_data *next; /**< Next description for this mob/obj/room */ +struct extra_descr_data { + char *keyword; /**< Keyword for look/examine */ + char *description; /**< What is shown when this keyword is 'seen' */ + struct extra_descr_data *next; /**< Next description for this mob/obj/room */ }; /* object-related structures */ @@ -674,76 +672,72 @@ struct extra_descr_data /** object flags used in obj_data. These represent the instance values for * a real object, values that can change during gameplay. */ -struct obj_flag_data -{ - int value[NUM_OBJ_VAL_POSITIONS]; /**< Values of the item (see list) */ - byte type_flag; /**< Type of item */ - int level; /**< Minimum level to use object */ - int wear_flags[TW_ARRAY_MAX]; /**< Where you can wear it, if wearable */ - int extra_flags[EF_ARRAY_MAX]; /**< If it hums, glows, etc. */ - int weight; /**< Weight of the object */ - int cost; /**< Value when sold */ - int cost_per_day; /**< Rent cost per real day */ - int timer; /**< Timer for object */ - int bitvector[AF_ARRAY_MAX]; /**< Affects characters */ +struct obj_flag_data { + int value[NUM_OBJ_VAL_POSITIONS]; /**< Values of the item (see list) */ + byte type_flag; /**< Type of item */ + int level; /**< Minimum level to use object */ + int wear_flags[TW_ARRAY_MAX]; /**< Where you can wear it, if wearable */ + int extra_flags[EF_ARRAY_MAX]; /**< If it hums, glows, etc. */ + int weight; /**< Weight of the object */ + int cost; /**< Value when sold */ + int cost_per_day; /**< Rent cost per real day */ + int timer; /**< Timer for object */ + int bitvector[AF_ARRAY_MAX]; /**< Affects characters */ }; /** Used in obj_file_elem. DO NOT CHANGE if you are using binary object files * and already have a player base and don't want to do a player wipe. */ -struct obj_affected_type -{ - byte location; /**< Which ability to change (APPLY_XXX) */ - sbyte modifier; /**< How much it changes by */ +struct obj_affected_type { + byte location; /**< Which ability to change (APPLY_XXX) */ + sbyte modifier; /**< How much it changes by */ }; /** The Object structure. */ -struct obj_data -{ - obj_rnum item_number; /**< The unique id of this object instance. */ - room_rnum in_room; /**< What room is the object lying in, or -1? */ +struct obj_data { + obj_rnum item_number; /**< The unique id of this object instance. */ + room_rnum in_room; /**< What room is the object lying in, or -1? */ - struct obj_flag_data obj_flags; /**< Object information */ - struct obj_affected_type affected[MAX_OBJ_AFFECT]; /**< affects */ + struct obj_flag_data obj_flags; /**< Object information */ + struct obj_affected_type affected[MAX_OBJ_AFFECT]; /**< affects */ - char *name; /**< Keyword reference(s) for object. */ - char *description; /**< Shown when the object is lying in a room. */ - char *short_description; /**< Shown when worn, carried, in a container */ - char *action_description; /**< Displays when (if) the object is used */ - struct extra_descr_data *ex_description; /**< List of extra descriptions */ - struct char_data *carried_by; /**< Points to PC/NPC carrying, or NULL */ - struct char_data *worn_by; /**< Points to PC/NPC wearing, or NULL */ - sh_int worn_on; /**< If the object can be worn, where can it be worn? */ + char *name; /**< Keyword reference(s) for object. */ + char *description; /**< Shown when the object is lying in a room. */ + char *short_description; /**< Shown when worn, carried, in a container */ + char *action_description; /**< Displays when (if) the object is used */ + struct extra_descr_data *ex_description; /**< List of extra descriptions */ + struct char_data *carried_by; /**< Points to PC/NPC carrying, or NULL */ + struct char_data *worn_by; /**< Points to PC/NPC wearing, or NULL */ + sh_int worn_on; /**< If the object can be worn, where can it be worn? */ - struct obj_data *in_obj; /**< Points to carrying object, or NULL */ - struct obj_data *contains; /**< List of objects being carried, or NULL */ + struct obj_data *in_obj; /**< Points to carrying object, or NULL */ + struct obj_data *contains; /**< List of objects being carried, or NULL */ - long script_id; /**< used by DG triggers - fetch only with obj_script_id() */ - struct trig_proto_list *proto_script; /**< list of default triggers */ - struct script_data *script; /**< script info for the object */ + long script_id; /**< used by DG triggers - fetch only with obj_script_id() */ + struct trig_proto_list *proto_script; /**< list of default triggers */ + struct script_data *script; /**< script info for the object */ - struct obj_data *next_content; /**< For 'contains' lists */ - struct obj_data *next; /**< For the object list */ - struct char_data *sitting_here; /**< For furniture, who is sitting in it */ - - struct list_data *events; /**< Used for object events */ + struct obj_data *next_content; /**< For 'contains' lists */ + struct obj_data *next; /**< For the object list */ + struct char_data *sitting_here; /**< For furniture, who is sitting in it */ + + struct list_data *events; /**< Used for object events */ }; /** Instance info for an object that gets saved to disk. * DO NOT CHANGE if you are using binary object files * and already have a player base and don't want to do a player wipe. */ -struct obj_file_elem -{ - obj_vnum item_number; /**< The prototype, non-unique info for this object. */ +struct obj_file_elem { + obj_vnum item_number; /**< The prototype, non-unique info for this object. */ #if USE_AUTOEQ - sh_int location; /**< If re-equipping objects on load, wear object here */ + sh_int location; /**< If re-equipping objects on load, wear object here */ #endif - int value[NUM_OBJ_VAL_POSITIONS]; /**< Current object values */ - int extra_flags[EF_ARRAY_MAX]; /**< Object extra flags */ - int weight; /**< Object weight */ - int timer; /**< Current object timer setting */ - int bitvector[AF_ARRAY_MAX]; /**< Object affects */ - struct obj_affected_type affected[MAX_OBJ_AFFECT]; /**< Affects to mobs */ + int value[NUM_OBJ_VAL_POSITIONS]; /**< Current object values */ + int extra_flags[EF_ARRAY_MAX]; /**< Object extra flags */ + int weight; /**< Object weight */ + int timer; /**< Current object timer setting */ + int bitvector[AF_ARRAY_MAX]; /**< Object affects */ + struct obj_affected_type affected[MAX_OBJ_AFFECT]; /**< Affects to mobs */ }; /** Header block for rent files. @@ -754,65 +748,61 @@ struct obj_file_elem * int datatype. * NOTE: This is *not* used with the ascii playerfiles. * NOTE 2: This structure appears to be unused in this codebase? */ -struct rent_info -{ - int time; - int rentcode; /**< How this character rented */ - int net_cost_per_diem; /**< ? Appears to be unused ? */ - int gold; /**< ? Appears to be unused ? */ - int account; /**< ? Appears to be unused ? */ - int nitems; /**< ? Appears to be unused ? */ - int spare0; - int spare1; - int spare2; - int spare3; - int spare4; - int spare5; - int spare6; - int spare7; +struct rent_info { + int time; + int rentcode; /**< How this character rented */ + int net_cost_per_diem; /**< ? Appears to be unused ? */ + int gold; /**< ? Appears to be unused ? */ + int account; /**< ? Appears to be unused ? */ + int nitems; /**< ? Appears to be unused ? */ + int spare0; + int spare1; + int spare2; + int spare3; + int spare4; + int spare5; + int spare6; + int spare7; }; /* room-related structures */ /** Direction (north, south, east...) information for rooms. */ -struct room_direction_data -{ - char *general_description; /**< Show to char looking in this direction. */ +struct room_direction_data { + char *general_description; /**< Show to char looking in this direction. */ - char *keyword; /**< for interacting (open/close) this direction */ + char *keyword; /**< for interacting (open/close) this direction */ - sh_int /*bitvector_t*/ exit_info; /**< Door, and what type? */ - obj_vnum key; /**< Key's vnum (-1 for no key) */ - room_rnum to_room; /**< Where direction leads, or NOWHERE if not defined */ + sh_int /*bitvector_t*/ exit_info; /**< Door, and what type? */ + obj_vnum key; /**< Key's vnum (-1 for no key) */ + room_rnum to_room; /**< Where direction leads, or NOWHERE if not defined */ }; /** The Room Structure. */ -struct room_data -{ - room_vnum number; /**< Rooms number (vnum) */ - zone_rnum zone; /**< Room zone (for resetting) */ - int sector_type; /**< sector type (move/hide) */ - int room_flags[RF_ARRAY_MAX]; /**< INDOORS, DARK, etc */ - char *name; /**< Room name */ - char *description; /**< Shown when entered, looked at */ - struct extra_descr_data *ex_description; /**< Additional things to look at */ - struct room_direction_data *dir_option[NUM_OF_DIRS]; /**< Directions */ - byte light; /**< Number of lightsources in room */ - SPECIAL(*func); /**< Points to special function attached to room */ - struct trig_proto_list *proto_script; /**< list of default triggers */ - struct script_data *script; /**< script info for the room */ - struct obj_data *contents; /**< List of items in room */ - struct char_data *people; /**< List of NPCs / PCs in room */ - - struct list_data * events; +struct room_data { + room_vnum number; /**< Rooms number (vnum) */ + zone_rnum zone; /**< Room zone (for resetting) */ + int sector_type; /**< sector type (move/hide) */ + int room_flags[RF_ARRAY_MAX]; /**< INDOORS, DARK, etc */ + char *name; /**< Room name */ + char *description; /**< Shown when entered, looked at */ + struct extra_descr_data *ex_description; /**< Additional things to look at */ + struct room_direction_data *dir_option[NUM_OF_DIRS]; /**< Directions */ + byte light; /**< Number of lightsources in room */ + SPECIAL(*func); /**< Points to special function attached to room */ + struct trig_proto_list *proto_script; /**< list of default triggers */ + struct script_data *script; /**< script info for the room */ + struct obj_data *contents; /**< List of items in room */ + struct char_data *people; /**< List of NPCs / PCs in room */ + + struct list_data * events; }; /* char-related structures */ /** Memory structure used by NPCs to remember specific PCs. */ -struct memory_rec_struct -{ - long id; /**< The PC id to remember. */ - struct memory_rec_struct *next; /**< Next PC to remember */ +struct memory_rec_struct { + long id; /**< The PC id to remember. */ + struct memory_rec_struct *next; /**< Next PC to remember */ }; /** memory_rec_struct typedef */ @@ -820,558 +810,520 @@ typedef struct memory_rec_struct memory_rec; /** This structure is purely intended to be an easy way to transfer and return * information about time (real or mudwise). */ -struct time_info_data -{ - int hours; /**< numeric hour */ - int day; /**< numeric day */ - int month; /**< numeric month */ - sh_int year; /**< numeric year */ +struct time_info_data { + int hours; /**< numeric hour */ + int day; /**< numeric day */ + int month; /**< numeric month */ + sh_int year; /**< numeric year */ }; /** Player specific time information. */ -struct time_data -{ - time_t birth; /**< Represents the PCs birthday, used to calculate age. */ - time_t logon; /**< Time of the last logon, used to calculate time played */ - int played; /**< This is the total accumulated time played in secs */ +struct time_data { + time_t birth; /**< Represents the PCs birthday, used to calculate age. */ + time_t logon; /**< Time of the last logon, used to calculate time played */ + int played; /**< This is the total accumulated time played in secs */ }; /* Group Data Struct */ -struct group_data -{ - struct char_data * leader; - struct list_data * members; - int group_flags; +struct group_data { + struct char_data * leader; + struct list_data * members; + int group_flags; }; /** The pclean_criteria_data is set up in config.c and used in db.c to determine * the conditions which will cause a player character to be deleted from disk * if the automagic pwipe system is enabled (see config.c). */ -struct pclean_criteria_data -{ - int level; /**< PC level and below to check for deletion */ - int days; /**< time limit in days, for this level of PC */ +struct pclean_criteria_data { + int level; /**< PC level and below to check for deletion */ + int days; /**< time limit in days, for this level of PC */ }; /** General info used by PC's and NPC's. */ -struct char_player_data -{ - char passwd[MAX_PWD_LENGTH+1]; /**< PC's password */ - char *name; /**< PC / NPC name */ - char *short_descr; /**< NPC 'actions' */ - char *long_descr; /**< PC / NPC look description */ - char *description; /**< NPC Extra descriptions */ - char *title; /**< PC / NPC title */ - byte sex; /**< PC / NPC sex */ - byte chclass; /**< PC / NPC class */ - byte level; /**< PC / NPC level */ - struct time_data time; /**< PC AGE in days */ - ubyte weight; /**< PC / NPC weight */ - ubyte height; /**< PC / NPC height */ +struct char_player_data { + char passwd[MAX_PWD_LENGTH+1]; /**< PC's password */ + char *name; /**< PC / NPC name */ + char *short_descr; /**< NPC 'actions' */ + char *long_descr; /**< PC / NPC look description */ + char *description; /**< NPC Extra descriptions */ + char *title; /**< PC / NPC title */ + byte sex; /**< PC / NPC sex */ + byte chclass; /**< PC / NPC class */ + byte level; /**< PC / NPC level */ + struct time_data time; /**< PC AGE in days */ + ubyte weight; /**< PC / NPC weight */ + ubyte height; /**< PC / NPC height */ }; /** Character abilities. Different instances of this structure are used for * both inherent and current ability scores (like when poison affects the * player strength). */ -struct char_ability_data -{ - sbyte str; /**< Strength. */ - sbyte str_add; /**< Strength multiplier if str = 18. Usually from 0 to 100 */ - sbyte intel; /**< Intelligence */ - sbyte wis; /**< Wisdom */ - sbyte dex; /**< Dexterity */ - sbyte con; /**< Constitution */ - sbyte cha; /**< Charisma */ +struct char_ability_data { + sbyte str; /**< Strength. */ + sbyte str_add; /**< Strength multiplier if str = 18. Usually from 0 to 100 */ + sbyte intel; /**< Intelligence */ + sbyte wis; /**< Wisdom */ + sbyte dex; /**< Dexterity */ + sbyte con; /**< Constitution */ + sbyte cha; /**< Charisma */ }; /** Character 'points', or health statistics. */ -struct char_point_data -{ - sh_int mana; /**< Current mana level */ - sh_int max_mana; /**< Max mana level */ - sh_int hit; /**< Curent hit point, or health, level */ - sh_int max_hit; /**< Max hit point, or health, level */ - sh_int move; /**< Current move point, or stamina, level */ - sh_int max_move; /**< Max move point, or stamina, level */ +struct char_point_data { + sh_int mana; /**< Current mana level */ + sh_int max_mana; /**< Max mana level */ + sh_int hit; /**< Curent hit point, or health, level */ + sh_int max_hit; /**< Max hit point, or health, level */ + sh_int move; /**< Current move point, or stamina, level */ + sh_int max_move; /**< Max move point, or stamina, level */ - /** Current armor class. Internal use goes from -100 (totally armored) to - * 100 (totally naked). Externally expressed as -10 (totally armored) to - * 10 (totally naked). Currently follows the old and decrepit Advanced - * Dungeons and Dragons method of dealing with character defense, or - * Armor class. */ - sh_int armor; - int gold; /**< Current gold carried on character */ - int bank_gold; /**< Gold the char has in a bank account */ - int exp; /**< The experience points, or value, of the character. */ + /** Current armor class. Internal use goes from -100 (totally armored) to + * 100 (totally naked). Externally expressed as -10 (totally armored) to + * 10 (totally naked). Currently follows the old and decrepit Advanced + * Dungeons and Dragons method of dealing with character defense, or + * Armor class. */ + sh_int armor; + int gold; /**< Current gold carried on character */ + int bank_gold; /**< Gold the char has in a bank account */ + int exp; /**< The experience points, or value, of the character. */ - sbyte hitroll; /**< Any bonus or penalty to the hit roll */ - sbyte damroll; /**< Any bonus or penalty to the damage roll */ + sbyte hitroll; /**< Any bonus or penalty to the hit roll */ + sbyte damroll; /**< Any bonus or penalty to the damage roll */ }; /** char_special_data_saved: specials which both a PC and an NPC have in * common, but which must be saved to the players file for PC's. */ -struct char_special_data_saved -{ - int alignment; /**< -1000 (evil) to 1000 (good) range. */ - long idnum; /**< PC's idnum; -1 for mobiles. */ - int act[PM_ARRAY_MAX]; /**< act flags for NPC's; player flag for PC's */ - int affected_by[AF_ARRAY_MAX]; /**< Bitvector for spells/skills affected by */ - sh_int apply_saving_throw[5]; /**< Saving throw (Bonuses) */ +struct char_special_data_saved { + int alignment; /**< -1000 (evil) to 1000 (good) range. */ + long idnum; /**< PC's idnum; -1 for mobiles. */ + int act[PM_ARRAY_MAX]; /**< act flags for NPC's; player flag for PC's */ + int affected_by[AF_ARRAY_MAX]; /**< Bitvector for spells/skills affected by */ + sh_int apply_saving_throw[5]; /**< Saving throw (Bonuses) */ }; /** Special playing constants shared by PCs and NPCs which aren't in pfile */ -struct char_special_data -{ - struct char_data *fighting; /**< Target of fight; else NULL */ - struct char_data *hunting; /**< Target of NPC hunt; else NULL */ - struct obj_data *furniture; /**< Object being sat on/in; else NULL */ - struct char_data *next_in_furniture; /**< Next person sitting, else NULL */ +struct char_special_data { + struct char_data *fighting; /**< Target of fight; else NULL */ + struct char_data *hunting; /**< Target of NPC hunt; else NULL */ + struct obj_data *furniture; /**< Object being sat on/in; else NULL */ + struct char_data *next_in_furniture; /**< Next person sitting, else NULL */ - byte position; /**< Standing, fighting, sleeping, etc. */ + byte position; /**< Standing, fighting, sleeping, etc. */ - int carry_weight; /**< Carried weight */ - byte carry_items; /**< Number of items carried */ - int timer; /**< Timer for update */ + int carry_weight; /**< Carried weight */ + byte carry_items; /**< Number of items carried */ + int timer; /**< Timer for update */ - struct char_special_data_saved saved; /**< Constants saved for PCs. */ + struct char_special_data_saved saved; /**< Constants saved for PCs. */ }; /** Data only needed by PCs, and needs to be saved to disk. */ -struct player_special_data_saved -{ - byte skills[MAX_SKILLS+1]; /**< Character skills. */ - int wimp_level; /**< Below this # of hit points, flee! */ - byte freeze_level; /**< Level of god who froze char, if any */ - sh_int invis_level; /**< level of invisibility */ - room_vnum load_room; /**< Which room to load PC into */ - int pref[PR_ARRAY_MAX]; /**< preference flags */ - ubyte bad_pws; /**< number of bad login attempts */ - sbyte conditions[3]; /**< Drunk, hunger, and thirst */ - struct txt_block *comm_hist[NUM_HIST]; /**< Communication history */ - ubyte page_length; /**< Max number of rows of text to send at once */ - ubyte screen_width; /**< How wide the display page is */ - int spells_to_learn; /**< Remaining number of practice sessions */ - int olc_zone; /**< Current olc permissions */ - int questpoints; /**< Number of quest points earned */ - qst_vnum *completed_quests; /**< Quests completed */ - int num_completed_quests; /**< Number completed */ - int current_quest; /**< vnum of current quest */ - int quest_time; /**< time left on current quest */ - int quest_counter; /**< Count of targets left to get */ - time_t lastmotd; /**< Last time player read motd */ - time_t lastnews; /**< Last time player read news */ +struct player_special_data_saved { + byte skills[MAX_SKILLS+1]; /**< Character skills. */ + int wimp_level; /**< Below this # of hit points, flee! */ + byte freeze_level; /**< Level of god who froze char, if any */ + sh_int invis_level; /**< level of invisibility */ + room_vnum load_room; /**< Which room to load PC into */ + int pref[PR_ARRAY_MAX]; /**< preference flags */ + ubyte bad_pws; /**< number of bad login attempts */ + sbyte conditions[3]; /**< Drunk, hunger, and thirst */ + struct txt_block *comm_hist[NUM_HIST]; /**< Communication history */ + ubyte page_length; /**< Max number of rows of text to send at once */ + ubyte screen_width; /**< How wide the display page is */ + int spells_to_learn; /**< Remaining number of practice sessions */ + int olc_zone; /**< Current olc permissions */ + int questpoints; /**< Number of quest points earned */ + qst_vnum *completed_quests;/**< Quests completed */ + int num_completed_quests; /**< Number completed */ + int current_quest; /**< vnum of current quest */ + int quest_time; /**< time left on current quest */ + int quest_counter; /**< Count of targets left to get */ + time_t lastmotd; /**< Last time player read motd */ + time_t lastnews; /**< Last time player read news */ }; /** Specials needed only by PCs, not NPCs. Space for this structure is * not allocated in memory for NPCs, but it is for PCs and the portion * of it labelled 'saved' is saved in the players file. */ -struct player_special_data -{ - struct player_special_data_saved saved; /**< Information to be saved. */ +struct player_special_data { + struct player_special_data_saved saved; /**< Information to be saved. */ - char *poofin; /**< Description displayed to room on arrival of a god. */ - char *poofout; /**< Description displayed to room at a god's exit. */ - struct alias_data *aliases; /**< Command aliases */ - long last_tell; /**< idnum of PC who last told this PC, used to reply */ - void *last_olc_targ; /**< ? Currently Unused ? */ - int last_olc_mode; /**< ? Currently Unused ? */ - char *host; /**< Resolved hostname, or ip, for player. */ - int buildwalk_sector; /**< Default sector type for buildwalk */ + char *poofin; /**< Description displayed to room on arrival of a god. */ + char *poofout; /**< Description displayed to room at a god's exit. */ + struct alias_data *aliases;/**< Command aliases */ + long last_tell; /**< idnum of PC who last told this PC, used to reply */ + void *last_olc_targ; /**< ? Currently Unused ? */ + int last_olc_mode; /**< ? Currently Unused ? */ + char *host; /**< Resolved hostname, or ip, for player. */ + int buildwalk_sector; /**< Default sector type for buildwalk */ }; /** Special data used by NPCs, not PCs */ -struct mob_special_data -{ - memory_rec *memory; /**< List of PCs to remember */ - byte attack_type; /**< The primary attack type (bite, sting, hit, etc.) */ - byte default_pos; /**< Default position (standing, sleeping, etc.) */ - byte damnodice; /**< The number of dice to roll for damage */ - byte damsizedice; /**< The size of each die rolled for damage. */ +struct mob_special_data { + memory_rec *memory; /**< List of PCs to remember */ + byte attack_type; /**< The primary attack type (bite, sting, hit, etc.) */ + byte default_pos; /**< Default position (standing, sleeping, etc.) */ + byte damnodice; /**< The number of dice to roll for damage */ + byte damsizedice; /**< The size of each die rolled for damage. */ }; /** An affect structure. */ -struct affected_type -{ - sh_int spell; /**< The spell that caused this */ - sh_int duration; /**< For how long its effects will last */ - sbyte modifier; /**< Added/subtracted to/from apropriate ability */ - byte location; /**< Tells which ability to change(APPLY_XXX). */ - int bitvector[AF_ARRAY_MAX]; /**< Tells which bits to set (AFF_XXX). */ +struct affected_type { + sh_int spell; /**< The spell that caused this */ + sh_int duration; /**< For how long its effects will last */ + sbyte modifier; /**< Added/subtracted to/from apropriate ability */ + byte location; /**< Tells which ability to change(APPLY_XXX). */ + int bitvector[AF_ARRAY_MAX]; /**< Tells which bits to set (AFF_XXX). */ - struct affected_type *next; /**< The next affect in the list of affects. */ + struct affected_type *next; /**< The next affect in the list of affects. */ }; /** The list element that makes up a list of characters following this * character. */ -struct follow_type -{ - struct char_data *follower; /**< Character directly following. */ - struct follow_type *next; /**< Next character following. */ +struct follow_type { + struct char_data *follower; /**< Character directly following. */ + struct follow_type *next; /**< Next character following. */ }; /** Master structure for PCs and NPCs. */ -struct char_data -{ - int pfilepos; /**< PC playerfile pos and id number */ - mob_rnum nr; /**< NPC real instance number */ - room_rnum in_room; /**< Current location (real room number) */ - room_rnum was_in_room; /**< Previous location for linkdead people */ - int wait; /**< wait for how many loops before taking action. */ +struct char_data { + int pfilepos; /**< PC playerfile pos and id number */ + mob_rnum nr; /**< NPC real instance number */ + room_rnum in_room; /**< Current location (real room number) */ + room_rnum was_in_room; /**< Previous location for linkdead people */ + int wait; /**< wait for how many loops before taking action. */ - struct char_player_data player; /**< General PC/NPC data */ - struct char_ability_data real_abils; /**< Abilities without modifiers */ - struct char_ability_data aff_abils; /**< Abilities with modifiers */ - struct char_point_data points; /**< Point/statistics */ - struct char_special_data char_specials; /**< PC/NPC specials */ - struct player_special_data *player_specials; /**< PC specials */ - struct mob_special_data mob_specials; /**< NPC specials */ + struct char_player_data player; /**< General PC/NPC data */ + struct char_ability_data real_abils; /**< Abilities without modifiers */ + struct char_ability_data aff_abils; /**< Abilities with modifiers */ + struct char_point_data points; /**< Point/statistics */ + struct char_special_data char_specials; /**< PC/NPC specials */ + struct player_special_data *player_specials; /**< PC specials */ + struct mob_special_data mob_specials; /**< NPC specials */ - struct affected_type *affected; /**< affected by what spells */ - struct obj_data *equipment[NUM_WEARS]; /**< Equipment array */ + struct affected_type *affected; /**< affected by what spells */ + struct obj_data *equipment[NUM_WEARS]; /**< Equipment array */ - struct obj_data *carrying; /**< List head for objects in inventory */ - struct descriptor_data *desc; /**< Descriptor/connection info; NPCs = NULL */ + struct obj_data *carrying; /**< List head for objects in inventory */ + struct descriptor_data *desc; /**< Descriptor/connection info; NPCs = NULL */ - long script_id; /**< used by DG triggers - fetch only with char_script_id() */ - struct trig_proto_list *proto_script; /**< list of default triggers */ - struct script_data *script; /**< script info for the object */ - struct script_memory *memory; /**< for mob memory triggers */ + long script_id; /**< used by DG triggers - fetch only with char_script_id() */ + struct trig_proto_list *proto_script; /**< list of default triggers */ + struct script_data *script; /**< script info for the object */ + struct script_memory *memory; /**< for mob memory triggers */ - struct char_data *next_in_room; /**< Next PC in the room */ - struct char_data *next; /**< Next char_data in the room */ - struct char_data *next_fighting; /**< Next in line to fight */ + struct char_data *next_in_room; /**< Next PC in the room */ + struct char_data *next; /**< Next char_data in the room */ + struct char_data *next_fighting; /**< Next in line to fight */ - struct follow_type *followers; /**< List of characters following */ - struct char_data *master; /**< List of character being followed */ + struct follow_type *followers; /**< List of characters following */ + struct char_data *master; /**< List of character being followed */ - struct group_data *group; /**< Character's Group */ + struct group_data *group; /**< Character's Group */ - long pref; /**< unique session id */ - - struct list_data * events; + long pref; /**< unique session id */ + + struct list_data * events; }; /** descriptor-related structures */ -struct txt_block -{ - char *text; /**< ? */ - int aliased; /**< ? */ - struct txt_block *next; /**< ? */ +struct txt_block { + char *text; /**< ? */ + int aliased; /**< ? */ + struct txt_block *next; /**< ? */ }; /** ? */ -struct txt_q -{ - struct txt_block *head; /**< ? */ - struct txt_block *tail; /**< ? */ +struct txt_q { + struct txt_block *head; /**< ? */ + struct txt_block *tail; /**< ? */ }; /** Master structure players. Holds the real players connection to the mud. * An analogy is the char_data is the body of the character, the descriptor_data * is the soul. */ -struct descriptor_data -{ - socket_t descriptor; /**< file descriptor for socket */ - char host[HOST_LENGTH+1]; /**< hostname */ - byte bad_pws; /**< number of bad pw attemps this login */ - byte idle_tics; /**< tics idle at password prompt */ - int connected; /**< mode of 'connectedness' */ - int desc_num; /**< unique num assigned to desc */ - time_t login_time; /**< when the person connected */ - char *showstr_head; /**< for keeping track of an internal str */ - char **showstr_vector; /**< for paging through texts */ - int showstr_count; /**< number of pages to page through */ - int showstr_page; /**< which page are we currently showing? */ - char **str; /**< for the modify-str system */ - char *backstr; /**< backup string for modify-str system */ - size_t max_str; /**< maximum size of string in modify-str */ - long mail_to; /**< name for mail system */ - int has_prompt; /**< is the user at a prompt? */ - char inbuf[MAX_RAW_INPUT_LENGTH]; /**< buffer for raw input */ - char last_input[MAX_INPUT_LENGTH]; /**< the last input */ - char small_outbuf[SMALL_BUFSIZE]; /**< standard output buffer */ - char *output; /**< ptr to the current output buffer */ - char **history; /**< History of commands, for ! mostly. */ - int history_pos; /**< Circular array position. */ - int bufptr; /**< ptr to end of current output */ - int bufspace; /**< space left in the output buffer */ - struct txt_block *large_outbuf; /**< ptr to large buffer, if we need it */ - struct txt_q input; /**< q of unprocessed input */ - struct char_data *character; /**< linked to char */ - struct char_data *original; /**< original char if switched */ - struct descriptor_data *snooping; /**< Who is this char snooping */ - struct descriptor_data *snoop_by; /**< And who is snooping this char */ - struct descriptor_data *next; /**< link to next descriptor */ - struct oasis_olc_data *olc; /**< OLC info */ - protocol_t *pProtocol; /**< Kavir plugin */ - - struct list_data * events; +struct descriptor_data { + socket_t descriptor; /**< file descriptor for socket */ + char host[HOST_LENGTH+1]; /**< hostname */ + byte bad_pws; /**< number of bad pw attemps this login */ + byte idle_tics; /**< tics idle at password prompt */ + int connected; /**< mode of 'connectedness' */ + int desc_num; /**< unique num assigned to desc */ + time_t login_time; /**< when the person connected */ + char *showstr_head; /**< for keeping track of an internal str */ + char **showstr_vector; /**< for paging through texts */ + int showstr_count; /**< number of pages to page through */ + int showstr_page; /**< which page are we currently showing? */ + char **str; /**< for the modify-str system */ + char *backstr; /**< backup string for modify-str system */ + size_t max_str; /**< maximum size of string in modify-str */ + long mail_to; /**< name for mail system */ + int has_prompt; /**< is the user at a prompt? */ + char inbuf[MAX_RAW_INPUT_LENGTH]; /**< buffer for raw input */ + char last_input[MAX_INPUT_LENGTH]; /**< the last input */ + char small_outbuf[SMALL_BUFSIZE]; /**< standard output buffer */ + char *output; /**< ptr to the current output buffer */ + char **history; /**< History of commands, for ! mostly. */ + int history_pos; /**< Circular array position. */ + int bufptr; /**< ptr to end of current output */ + int bufspace; /**< space left in the output buffer */ + struct txt_block *large_outbuf; /**< ptr to large buffer, if we need it */ + struct txt_q input; /**< q of unprocessed input */ + struct char_data *character; /**< linked to char */ + struct char_data *original; /**< original char if switched */ + struct descriptor_data *snooping; /**< Who is this char snooping */ + struct descriptor_data *snoop_by; /**< And who is snooping this char */ + struct descriptor_data *next; /**< link to next descriptor */ + struct oasis_olc_data *olc; /**< OLC info */ + protocol_t *pProtocol; /**< Kavir plugin */ + + struct list_data * events; }; /* other miscellaneous structures */ /** Fight message display. This structure is used to hold the information to * be displayed for every different violent hit type. */ -struct msg_type -{ - char *attacker_msg; /**< Message displayed to attecker. */ - char *victim_msg; /**< Message displayed to victim. */ - char *room_msg; /**< Message displayed to rest of players in room. */ +struct msg_type { + char *attacker_msg; /**< Message displayed to attecker. */ + char *victim_msg; /**< Message displayed to victim. */ + char *room_msg; /**< Message displayed to rest of players in room. */ }; /** An entire message structure for a type of hit or spell or skill. */ -struct message_type -{ - struct msg_type die_msg; /**< Messages for death strikes. */ - struct msg_type miss_msg; /**< Messages for missed strikes. */ - struct msg_type hit_msg; /**< Messages for a succesful strike. */ - struct msg_type god_msg; /**< Messages when trying to hit a god. */ - struct message_type *next; /**< Next set of messages. */ +struct message_type { + struct msg_type die_msg; /**< Messages for death strikes. */ + struct msg_type miss_msg; /**< Messages for missed strikes. */ + struct msg_type hit_msg; /**< Messages for a succesful strike. */ + struct msg_type god_msg; /**< Messages when trying to hit a god. */ + struct message_type *next; /**< Next set of messages. */ }; /** Head of list of messages for an attack type. */ -struct message_list -{ - int a_type; /**< The id of this attack type. */ - int number_of_attacks; /**< How many attack messages to chose from. */ - struct message_type *msg; /**< List of messages. */ +struct message_list { + int a_type; /**< The id of this attack type. */ + int number_of_attacks; /**< How many attack messages to chose from. */ + struct message_type *msg; /**< List of messages. */ }; /** Social message data structure. */ -struct social_messg -{ - int act_nr; /**< The social id. */ - char *command; /**< The command to activate (smile, wave, etc.) */ - char *sort_as; /**< Priority of social sorted by this. */ - int hide; /**< If true, and target can't see actor, target doesn't see */ - int min_victim_position; /**< Required Position of victim */ - int min_char_position; /**< Required Position of char */ - int min_level_char; /**< Minimum PC level required to use this social. */ +struct social_messg { + int act_nr; /**< The social id. */ + char *command; /**< The command to activate (smile, wave, etc.) */ + char *sort_as; /**< Priority of social sorted by this. */ + int hide; /**< If true, and target can't see actor, target doesn't see */ + int min_victim_position; /**< Required Position of victim */ + int min_char_position; /**< Required Position of char */ + int min_level_char; /**< Minimum PC level required to use this social. */ - /* No argument was supplied */ - char *char_no_arg; /**< Displayed to char when no argument is supplied */ - char *others_no_arg; /**< Displayed to others when no arg is supplied */ + /* No argument was supplied */ + char *char_no_arg; /**< Displayed to char when no argument is supplied */ + char *others_no_arg; /**< Displayed to others when no arg is supplied */ - /* An argument was there, and a victim was found */ - char *char_found; /**< Display to char when arg is supplied */ - char *others_found; /**< Display to others when arg is supplied */ - char *vict_found; /**< Display to target arg */ + /* An argument was there, and a victim was found */ + char *char_found; /**< Display to char when arg is supplied */ + char *others_found; /**< Display to others when arg is supplied */ + char *vict_found; /**< Display to target arg */ - /* An argument was there, as well as a body part, and a victim was found */ - char *char_body_found; /**< Display to actor */ - char *others_body_found; /**< Display to others */ - char *vict_body_found; /**< Display to target argument */ + /* An argument was there, as well as a body part, and a victim was found */ + char *char_body_found; /**< Display to actor */ + char *others_body_found; /**< Display to others */ + char *vict_body_found; /**< Display to target argument */ - /* An argument was there, but no victim was found */ - char *not_found; /**< Display when no victim is found */ + /* An argument was there, but no victim was found */ + char *not_found; /**< Display when no victim is found */ - /* The victim turned out to be the character */ - char *char_auto; /**< Display when self is supplied */ - char *others_auto; /**< Display to others when self is supplied */ + /* The victim turned out to be the character */ + char *char_auto; /**< Display when self is supplied */ + char *others_auto; /**< Display to others when self is supplied */ - /* If the char cant be found search the char's inven and do these: */ - char *char_obj_found; /**< Social performed on object, display to char */ - char *others_obj_found; /**< Social performed on object, display to others */ + /* If the char cant be found search the char's inven and do these: */ + char *char_obj_found; /**< Social performed on object, display to char */ + char *others_obj_found; /**< Social performed on object, display to others */ }; /** Describes bonuses, or negatives, applied to thieves skills. In practice * this list is tied to the character's dexterity attribute. */ -struct dex_skill_type -{ - sh_int p_pocket; /**< Alters the success rate of pick pockets */ - sh_int p_locks; /**< Alters the success of pick locks */ - sh_int traps; /**< Historically alters the success of trap finding. */ - sh_int sneak; /**< Alters the success of sneaking without being detected */ - sh_int hide; /**< Alters the success of hiding out of sight */ +struct dex_skill_type { + sh_int p_pocket; /**< Alters the success rate of pick pockets */ + sh_int p_locks; /**< Alters the success of pick locks */ + sh_int traps; /**< Historically alters the success of trap finding. */ + sh_int sneak; /**< Alters the success of sneaking without being detected */ + sh_int hide; /**< Alters the success of hiding out of sight */ }; /** Describes the bonuses applied for a specific value of a character's * strength attribute. */ -struct dex_app_type -{ - sh_int reaction; /**< Historically affects reaction savings throws. */ - sh_int miss_att; /**< Historically affects missile attacks */ - sh_int defensive; /**< Alters character's inherent armor class */ +struct dex_app_type { + sh_int reaction; /**< Historically affects reaction savings throws. */ + sh_int miss_att; /**< Historically affects missile attacks */ + sh_int defensive; /**< Alters character's inherent armor class */ }; /** Describes the bonuses applied for a specific value of a character's * strength attribute. */ -struct str_app_type -{ - sh_int tohit; /**< To Hit (THAC0) Bonus/Penalty */ - sh_int todam; /**< Damage Bonus/Penalty */ - sh_int carry_w; /**< Maximum weight that can be carrried */ - sh_int wield_w; /**< Maximum weight that can be wielded */ +struct str_app_type { + sh_int tohit; /**< To Hit (THAC0) Bonus/Penalty */ + sh_int todam; /**< Damage Bonus/Penalty */ + sh_int carry_w; /**< Maximum weight that can be carrried */ + sh_int wield_w; /**< Maximum weight that can be wielded */ }; /** Describes the bonuses applied for a specific value of a character's * wisdom attribute. */ -struct wis_app_type -{ - byte bonus; /**< how many practices player gains per lev */ +struct wis_app_type { + byte bonus; /**< how many practices player gains per lev */ }; /** Describes the bonuses applied for a specific value of a character's * intelligence attribute. */ -struct int_app_type -{ - byte learn; /**< how many % a player learns a spell/skill */ +struct int_app_type { + byte learn; /**< how many % a player learns a spell/skill */ }; /** Describes the bonuses applied for a specific value of a * character's constitution attribute. */ -struct con_app_type -{ - sh_int hitp; /**< Added to a character's new MAXHP at each new level. */ +struct con_app_type { + sh_int hitp; /**< Added to a character's new MAXHP at each new level. */ }; /** Stores, and used to deliver, the current weather information * in the mud world. */ -struct weather_data -{ - int pressure; /**< How is the pressure ( Mb )? */ - int change; /**< How fast and what way does it change? */ - int sky; /**< How is the sky? */ - int sunlight; /**< And how much sun? */ +struct weather_data { + int pressure; /**< How is the pressure ( Mb )? */ + int change; /**< How fast and what way does it change? */ + int sky; /**< How is the sky? */ + int sunlight; /**< And how much sun? */ }; /** Element in monster and object index-tables. NOTE: Assumes sizeof(mob_vnum) >= sizeof(obj_vnum) */ -struct index_data -{ - mob_vnum vnum; /**< virtual number of this mob/obj */ - int number; /**< number of existing units of this mob/obj */ - /** Point to any SPECIAL function assoicated with mob/obj. - * Note: These are not trigger scripts. They are functions hard coded in - * the source code. */ - SPECIAL(*func); +struct index_data { + mob_vnum vnum; /**< virtual number of this mob/obj */ + int number; /**< number of existing units of this mob/obj */ + /** Point to any SPECIAL function assoicated with mob/obj. + * Note: These are not trigger scripts. They are functions hard coded in + * the source code. */ + SPECIAL(*func); - char *farg; /**< String argument for special function. */ - struct trig_data *proto; /**< Points to the trigger prototype. */ + char *farg; /**< String argument for special function. */ + struct trig_data *proto;/**< Points to the trigger prototype. */ }; /** Master linked list for the mob/object prototype trigger lists. */ -struct trig_proto_list -{ - int vnum; /**< vnum of the trigger */ - struct trig_proto_list *next; /**< next trigger */ +struct trig_proto_list { + int vnum; /**< vnum of the trigger */ + struct trig_proto_list *next; /**< next trigger */ }; -struct guild_info_type -{ - int pc_class; - room_vnum guild_room; - int direction; +struct guild_info_type { + int pc_class; + room_vnum guild_room; + int direction; }; /** Happy Hour Data */ struct happyhour { - int qp_rate; - int exp_rate; - int gold_rate; - int ticks_left; + int qp_rate; + int exp_rate; + int gold_rate; + int ticks_left; }; /** structure for list of recent players (see 'recent' command) */ -struct recent_player -{ - int vnum; /* The ID number for this instance */ - char name[MAX_NAME_LENGTH+1];/* The char name of the player */ - bool new_player; /* Is this a new player? */ - bool copyover_player; /* Is this a player that was on during the last copyover? */ - time_t time; /* login time */ - char host[HOST_LENGTH+1]; /* Host IP address */ - struct recent_player *next; /* Pointer to the next instance */ +struct recent_player { + int vnum; /* The ID number for this instance */ + char name[MAX_NAME_LENGTH+1];/* The char name of the player */ + bool new_player; /* Is this a new player? */ + bool copyover_player; /* Is this a player that was on during the last copyover? */ + time_t time; /* login time */ + char host[HOST_LENGTH+1]; /* Host IP address */ + struct recent_player *next; /* Pointer to the next instance */ }; /* Config structs */ /** The game configuration structure used for configurating the game play * variables. */ -struct game_data -{ - int pk_allowed; /**< Is player killing allowed? */ - int pt_allowed; /**< Is player thieving allowed? */ - int level_can_shout; /**< Level player must be to shout. */ - int holler_move_cost; /**< Cost to holler in move points. */ - int tunnel_size; /**< Number of people allowed in a tunnel.*/ - int max_exp_gain; /**< Maximum experience gainable per kill.*/ - int max_exp_loss; /**< Maximum experience losable per death.*/ - int max_npc_corpse_time; /**< Num tics before NPC corpses decompose*/ - int max_pc_corpse_time; /**< Num tics before PC corpse decomposes.*/ - int idle_void; /**< Num tics before PC sent to void(idle)*/ - int idle_rent_time; /**< Num tics before PC is autorented. */ - int idle_max_level; /**< Level of players immune to idle. */ - int dts_are_dumps; /**< Should items in dt's be junked? */ - int load_into_inventory; /**< Objects load in immortals inventory. */ - 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) */ - int script_players; /**< Is attaching scripts to players allowed? */ +struct game_data { + int pk_allowed; /**< Is player killing allowed? */ + int pt_allowed; /**< Is player thieving allowed? */ + int level_can_shout; /**< Level player must be to shout. */ + int holler_move_cost; /**< Cost to holler in move points. */ + int tunnel_size; /**< Number of people allowed in a tunnel.*/ + int max_exp_gain; /**< Maximum experience gainable per kill.*/ + int max_exp_loss; /**< Maximum experience losable per death.*/ + int max_npc_corpse_time; /**< Num tics before NPC corpses decompose*/ + int max_pc_corpse_time; /**< Num tics before PC corpse decomposes.*/ + int idle_void; /**< Num tics before PC sent to void(idle)*/ + int idle_rent_time; /**< Num tics before PC is autorented. */ + int idle_max_level; /**< Level of players immune to idle. */ + int dts_are_dumps; /**< Should items in dt's be junked? */ + int load_into_inventory; /**< Objects load in immortals inventory. */ + 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) */ + int script_players; /**< Is attaching scripts to players allowed? */ - char *OK; /**< When player receives 'Okay.' text. */ - char *HUH; /**< 'Huh!?!' */ - char *NOPERSON; /**< 'No one by that name here.' */ - char *NOEFFECT; /**< 'Nothing seems to happen.' */ + char *OK; /**< When player receives 'Okay.' text. */ + char *HUH; /**< 'Huh!?!' */ + char *NOPERSON; /**< 'No one by that name here.' */ + char *NOEFFECT; /**< 'Nothing seems to happen.' */ }; /** The rent and crashsave options. */ -struct crash_save_data -{ - int free_rent; /**< Should the MUD allow rent for free? */ - int max_obj_save; /**< Max items players can rent. */ - int min_rent_cost; /**< surcharge on top of item costs. */ - int auto_save; /**< Does the game automatically save ppl? */ - int autosave_time; /**< if auto_save=TRUE, how often? */ - int crash_file_timeout; /**< Life of crashfiles and idlesaves. */ - int rent_file_timeout; /**< Lifetime of normal rent files in days */ +struct crash_save_data { + int free_rent; /**< Should the MUD allow rent for free? */ + int max_obj_save; /**< Max items players can rent. */ + int min_rent_cost; /**< surcharge on top of item costs. */ + int auto_save; /**< Does the game automatically save ppl? */ + int autosave_time; /**< if auto_save=TRUE, how often? */ + int crash_file_timeout; /**< Life of crashfiles and idlesaves. */ + int rent_file_timeout; /**< Lifetime of normal rent files in days */ }; /** Important room numbers. This structure stores vnums, not real array * numbers. */ -struct room_numbers -{ - room_vnum mortal_start_room; /**< vnum of room that mortals enter at. */ - room_vnum immort_start_room; /**< vnum of room that immorts enter at. */ - room_vnum frozen_start_room; /**< vnum of room that frozen ppl enter. */ - room_vnum donation_room_1; /**< vnum of donation room #1. */ - room_vnum donation_room_2; /**< vnum of donation room #2. */ - room_vnum donation_room_3; /**< vnum of donation room #3. */ +struct room_numbers { + room_vnum mortal_start_room; /**< vnum of room that mortals enter at. */ + room_vnum immort_start_room; /**< vnum of room that immorts enter at. */ + room_vnum frozen_start_room; /**< vnum of room that frozen ppl enter. */ + room_vnum donation_room_1; /**< vnum of donation room #1. */ + room_vnum donation_room_2; /**< vnum of donation room #2. */ + room_vnum donation_room_3; /**< vnum of donation room #3. */ }; /** Operational game variables. */ -struct game_operation -{ - ush_int DFLT_PORT; /**< The default port to run the game. */ - char *DFLT_IP; /**< Bind to all interfaces. */ - char *DFLT_DIR; /**< The default directory (lib). */ - char *LOGNAME; /**< The file to log messages to. */ - int max_playing; /**< Maximum number of players allowed. */ - int max_filesize; /**< Maximum size of misc files. */ - int max_bad_pws; /**< Maximum number of pword attempts. */ - int siteok_everyone; /**< Everyone from all sites are SITEOK.*/ - int nameserver_is_slow; /**< Is the nameserver slow or fast? */ - int use_new_socials; /**< Use new or old socials file ? */ - int auto_save_olc; /**< Does OLC save to disk right away ? */ - char *MENU; /**< The MAIN MENU. */ - char *WELC_MESSG; /**< The welcome message. */ - char *START_MESSG; /**< The start msg for new characters. */ - int medit_advanced; /**< Does the medit OLC show the advanced stats menu ? */ - int ibt_autosave; /**< Does "bug resolve" autosave ? */ - int protocol_negotiation; /**< Enable the protocol negotiation system ? */ - int special_in_comm; /**< Enable use of a special character in communication channels ? */ - int debug_mode; /**< Current Debug Mode */ +struct game_operation { + ush_int DFLT_PORT; /**< The default port to run the game. */ + char *DFLT_IP; /**< Bind to all interfaces. */ + char *DFLT_DIR; /**< The default directory (lib). */ + char *LOGNAME; /**< The file to log messages to. */ + int max_playing; /**< Maximum number of players allowed. */ + int max_filesize; /**< Maximum size of misc files. */ + int max_bad_pws; /**< Maximum number of pword attempts. */ + int siteok_everyone; /**< Everyone from all sites are SITEOK.*/ + int nameserver_is_slow; /**< Is the nameserver slow or fast? */ + int use_new_socials; /**< Use new or old socials file ? */ + int auto_save_olc; /**< Does OLC save to disk right away ? */ + char *MENU; /**< The MAIN MENU. */ + char *WELC_MESSG; /**< The welcome message. */ + char *START_MESSG; /**< The start msg for new characters. */ + int medit_advanced; /**< Does the medit OLC show the advanced stats menu ? */ + int ibt_autosave; /**< Does "bug resolve" autosave ? */ + int protocol_negotiation; /**< Enable the protocol negotiation system ? */ + int special_in_comm; /**< Enable use of a special character in communication channels ? */ + int debug_mode; /**< Current Debug Mode */ }; /** The Autowizard options. */ -struct autowiz_data -{ - int use_autowiz; /**< Use the autowiz feature? */ - int min_wizlist_lev; /**< Minimun level to show on wizlist. */ +struct autowiz_data { + int use_autowiz; /**< Use the autowiz feature? */ + int min_wizlist_lev; /**< Minimun level to show on wizlist. */ }; /** @@ -1383,20 +1335,19 @@ struct autowiz_data If changes are made to values of the elements of this structure during game play, the information will be saved to disk. */ -struct config_data -{ - /** Path to on-disk file where the config_data structure gets written. */ - char *CONFFILE; - /** In-game specific global settings, such as allowing player killing. */ - struct game_data play; - /** How is renting, crash files, and object saving handled? */ - struct crash_save_data csd; - /** Special designated rooms, like start rooms, and donation rooms. */ - struct room_numbers room_nums; - /** Basic operational settings, like max file sizes and max players. */ - struct game_operation operation; - /** Autowiz specific settings, like turning it on and minimum level */ - struct autowiz_data autowiz; +struct config_data { + /** Path to on-disk file where the config_data structure gets written. */ + char *CONFFILE; + /** In-game specific global settings, such as allowing player killing. */ + struct game_data play; + /** How is renting, crash files, and object saving handled? */ + struct crash_save_data csd; + /** Special designated rooms, like start rooms, and donation rooms. */ + struct room_numbers room_nums; + /** Basic operational settings, like max file sizes and max players. */ + struct game_operation operation; + /** Autowiz specific settings, like turning it on and minimum level */ + struct autowiz_data autowiz; }; #ifdef MEMORY_DEBUG diff --git a/src/sysdep.h b/src/sysdep.h index b7e5542..6213971 100644 --- a/src/sysdep.h +++ b/src/sysdep.h @@ -1,29 +1,29 @@ /** * @file sysdep.h * Machine-specific defs based on values in conf.h (from configure) -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. */ #ifndef _SYSDEP_H_ #define _SYSDEP_H_ /* Configurables: tbaMUD uses the crypt(3) function to encrypt player passwords * in the players file so that they are never stored in plaintext form. However, - * due to U.S. export restrictions on machine-readable cryptographic software, - * the crypt() function is not available on some operating systems such as - * FreeBSD. By default, the 'configure' script will determine if you have - * crypt() available and enable or disable password encryption appropriately. + * due to U.S. export restrictions on machine-readable cryptographic software, + * the crypt() function is not available on some operating systems such as + * FreeBSD. By default, the 'configure' script will determine if you have + * crypt() available and enable or disable password encryption appropriately. * #define NOCRYPT (by uncommenting the line below) if you'd like to explicitly * disable password encryption (i.e., if you have moved your MUD from an OS that * does not support encryption to one that does). */ /* #define NOCRYPT */ -/* If you are porting tbaMUD to a new (untested) platform and you find that +/* If you are porting tbaMUD to a new (untested) platform and you find that * POSIX-standard non-blocking I/O does *not* work, you can define the constant * below to work around the problem. Not having non-blocking I/O can cause the * MUD to freeze if someone types part of a command while the MUD waits for the @@ -32,17 +32,17 @@ * NOTE: **DO** **NOT** use this constant unless you are SURE you understand * exactly what non-blocking I/O is, and you are SURE that your operating system * does NOT have it! (The only UNIX system I've ever seen that has broken POSIX - * non-blocking I/O is AIX 3.2.) If your MUD is freezing but you're not sure - * why, do NOT use this constant. Use this constant ONLY if you're sure that + * non-blocking I/O is AIX 3.2.) If your MUD is freezing but you're not sure + * why, do NOT use this constant. Use this constant ONLY if you're sure that * your MUD is freezing because of a non-blocking I/O problem. */ /* #define POSIX_NONBLOCK_BROKEN */ /* The code prototypes library functions to avoid compiler warnings. (Operating * system header files *should* do this, but sometimes don't.) However, Circle's * prototypes cause the compilation to fail under some combinations of operating - * systems and compilers. If your compiler reports "conflicting types" for - * functions, you need to define this constant to turn off library function - * prototyping. Note, **DO** **NOT** blindly turn on this constant unless you + * systems and compilers. If your compiler reports "conflicting types" for + * functions, you need to define this constant to turn off library function + * prototyping. Note, **DO** **NOT** blindly turn on this constant unless you * are sure the problem is type conflicts between my header files and the header * files of your operating system. The error message will look something like * this: In file included from comm.c:14: @@ -51,7 +51,7 @@ * previous declaration of `random' */ /* #define NO_LIBRARY_PROTOTYPES */ -/* If using the GNU C library, version 2+, then you can have it trace memory +/* If using the GNU C library, version 2+, then you can have it trace memory * allocations to check for leaks, uninitialized uses, and bogus free() calls. * To see if your version supports it, run: * info libc 'Allocation Debugging' 'Tracing malloc' @@ -59,11 +59,11 @@ * MALLOC_TRACE=/tmp/circle-trace bin/circle * Read the entire "Allocation Debugging" section of the GNU C library * documentation before setting this to '1'. */ -#define CIRCLE_GNU_LIBC_MEMORY_TRACK 0 /* 0 = off, 1 = on */ +#define CIRCLE_GNU_LIBC_MEMORY_TRACK 0 /* 0 = off, 1 = on */ /* Do not change anything below this line. */ -/* Set up various machine-specific things based on the values determined from +/* Set up various machine-specific things based on the values determined from * configure and conf.h. */ #include @@ -173,7 +173,7 @@ extern void abort (), exit (); #ifndef HAVE_STRUCT_IN_ADDR struct in_addr { - unsigned long int s_addr; /* for inet_addr, etc. */ + unsigned long int s_addr; /* for inet_addr, etc. */ } #endif @@ -219,7 +219,7 @@ struct in_addr { # include # undef _POSIX_C_SOURCE # else -# include /* GNU libc 6 already defines _POSIX_C_SOURCE. */ +# include /* GNU libc 6 already defines _POSIX_C_SOURCE. */ # endif #endif @@ -251,39 +251,39 @@ struct in_addr { #endif #if !defined(__GNUC__) -# define __attribute__(x) /* nothing */ +# define __attribute__(x) /* nothing */ #endif #if defined(__MWERKS__) -# define isascii(c) (((c) & ~0x7f) == 0) /* So easy to have, but ... */ +# define isascii(c) (((c) & ~0x7f) == 0) /* So easy to have, but ... */ #endif /* Socket/header miscellany. */ -#if defined(CIRCLE_WINDOWS) /* Definitions for Win32 */ +#if defined(CIRCLE_WINDOWS) /* Definitions for Win32 */ # define snprintf _snprintf # define vsnprintf _vsnprintf # define PATH_MAX MAX_PATH -# if !defined(__BORLANDC__) && !defined(LCC_WIN32) /* MSVC */ +# if !defined(__BORLANDC__) && !defined(LCC_WIN32) /* MSVC */ # define chdir _chdir -# pragma warning(disable:4761) /* Integral size mismatch. */ -# pragma warning(disable:4244) /* Possible loss of data. */ +# pragma warning(disable:4761) /* Integral size mismatch. */ +# pragma warning(disable:4244) /* Possible loss of data. */ # endif -# if defined(__BORLANDC__) /* Silence warnings we don't care about. */ -# pragma warn -par /* to turn off >parameter< 'ident' is never used. */ -# pragma warn -pia /* to turn off possibly incorrect assignment. 'if (!(x=a))' */ -# pragma warn -sig /* to turn off conversion may lose significant digits. */ +# if defined(__BORLANDC__) /* Silence warnings we don't care about. */ +# pragma warn -par /* to turn off >parameter< 'ident' is never used. */ +# pragma warn -pia /* to turn off possibly incorrect assignment. 'if (!(x=a))' */ +# pragma warn -sig /* to turn off conversion may lose significant digits. */ # endif -# ifndef _WINSOCK2API_ /* Winsock1 and Winsock 2 conflict. */ +# ifndef _WINSOCK2API_ /* Winsock1 and Winsock 2 conflict. */ # include # endif -# ifndef FD_SETSIZE /* MSVC 6 is reported to have 64. */ -# define FD_SETSIZE 1024 +# ifndef FD_SETSIZE /* MSVC 6 is reported to have 64. */ +# define FD_SETSIZE 1024 # endif #elif defined(CIRCLE_VMS) @@ -302,17 +302,17 @@ struct in_addr { /* SOCKET -- must be after the winsock.h #include. */ #ifdef CIRCLE_WINDOWS -# define CLOSE_SOCKET(sock) closesocket(sock) - typedef SOCKET socket_t; +# define CLOSE_SOCKET(sock) closesocket(sock) +typedef SOCKET socket_t; #else -# define CLOSE_SOCKET(sock) close(sock) - typedef int socket_t; +# define CLOSE_SOCKET(sock) close(sock) +typedef int socket_t; #endif -#if defined(__cplusplus) /* C++ */ -#define cpp_extern extern -#else /* C */ -#define cpp_extern /* Nothing */ +#if defined(__cplusplus) /* C++ */ +#define cpp_extern extern +#else /* C */ +#define cpp_extern /* Nothing */ #endif #ifndef CIRCLE_OS_X @@ -341,224 +341,224 @@ struct in_addr { /* Function prototypes. */ /* Header files of many OS's do not contain function prototypes for the - * standard C library functions. This produces annoying warning messages + * standard C library functions. This produces annoying warning messages * (sometimes, a lot of them) on such OS's when compiling with gcc's -Wall. * - * Configuration script has been changed to detect which prototypes exist - * already; this header file only prototypes functions that aren't already - * prototyped by the system headers. A clash should be impossible. This + * Configuration script has been changed to detect which prototypes exist + * already; this header file only prototypes functions that aren't already + * prototyped by the system headers. A clash should be impossible. This * should give us our strong type-checking back. */ #ifndef NO_LIBRARY_PROTOTYPES #ifdef NEED_ATOI_PROTO - int atoi(const char *str); +int atoi(const char *str); #endif #ifdef NEED_ATOL_PROTO - long atol(const char *str); +long atol(const char *str); #endif -/* bzero is deprecated - use memset() instead. This prototype is needed for +/* bzero is deprecated - use memset() instead. This prototype is needed for * FD_xxx macros on some machines. */ #ifdef NEED_BZERO_PROTO - void bzero(char *b, int length); +void bzero(char *b, int length); #endif #ifdef NEED_CRYPT_PROTO - char *crypt(const char *key, const char *salt); +char *crypt(const char *key, const char *salt); #endif #ifdef NEED_FCLOSE_PROTO - int fclose(FILE *stream); +int fclose(FILE *stream); #endif #ifdef NEED_FDOPEN_PROTO - FILE *fdopen(int fd, const char *mode); +FILE *fdopen(int fd, const char *mode); #endif #ifdef NEED_FFLUSH_PROTO - int fflush(FILE *stream); +int fflush(FILE *stream); #endif #ifdef NEED_FPRINTF_PROTO - int fprintf(FILE *strm, const char *format, /* args */ ... ); +int fprintf(FILE *strm, const char *format, /* args */ ... ); #endif #ifdef NEED_FREAD_PROTO - size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream); +size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream); #endif #ifdef NEED_FSCANF_PROTO - int fscanf(FILE *strm, const char *format, ...); +int fscanf(FILE *strm, const char *format, ...); #endif #ifdef NEED_FSEEK_PROTO - int fseek(FILE *stream, long offset, int ptrname); +int fseek(FILE *stream, long offset, int ptrname); #endif #ifdef NEED_FWRITE_PROTO - size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream); +size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream); #endif #ifdef NEED_GETPID_PROTO - pid_t getpid(void); +pid_t getpid(void); #endif #ifdef NEED_PERROR_PROTO - void perror(const char *s); +void perror(const char *s); #endif #ifdef NEED_QSORT_PROTO - void qsort(void *base, size_t nel, size_t width, - int (*compar) (const void *, const void *)); +void qsort(void *base, size_t nel, size_t width, + int (*compar) (const void *, const void *)); #endif #ifdef NEED_REWIND_PROTO - void rewind(FILE *stream); +void rewind(FILE *stream); #endif #ifdef NEED_SPRINTF_PROTO - int sprintf(char *s, const char *format, /* args */ ... ); +int sprintf(char *s, const char *format, /* args */ ... ); #endif #ifdef NEED_SSCANF_PROTO - int sscanf(const char *s, const char *format, ...); +int sscanf(const char *s, const char *format, ...); #endif #ifdef NEED_STRDUP_PROTO - char *strdup(const char *txt); +char *strdup(const char *txt); #endif #ifdef NEED_STRERROR_PROTO - char *strerror(int errnum); +char *strerror(int errnum); #endif #ifdef NEED_STRLCPY_PROTO - size_t strlcpy(char *dest, const char *src, size_t copylen); +size_t strlcpy(char *dest, const char *src, size_t copylen); #endif #ifdef NEED_SYSTEM_PROTO - int system(const char *string); +int system(const char *string); #endif #ifdef NEED_TIME_PROTO - time_t time(time_t *tloc); +time_t time(time_t *tloc); #endif #ifdef NEED_UNLINK_PROTO - int unlink(const char *path); +int unlink(const char *path); #endif #ifdef NEED_REMOVE_PROTO - int remove(const char *path); +int remove(const char *path); #endif #ifdef NEED_ACCEPT_PROTO - int accept(socket_t s, struct sockaddr *addr, int *addrlen); +int accept(socket_t s, struct sockaddr *addr, int *addrlen); #endif #ifdef NEED_BIND_PROTO - int bind(socket_t s, const struct sockaddr *name, int namelen); +int bind(socket_t s, const struct sockaddr *name, int namelen); #endif #ifdef NEED_CHDIR_PROTO - int chdir(const char *path); +int chdir(const char *path); #endif #ifdef NEED_CLOSE_PROTO - int close(int fildes); +int close(int fildes); #endif #ifdef NEED_FCNTL_PROTO - int fcntl(int fildes, int cmd, /* arg */ ...); +int fcntl(int fildes, int cmd, /* arg */ ...); #endif #ifdef NEED_FPUTC_PROTO - int fputc(char c, FILE *stream); +int fputc(char c, FILE *stream); #endif #ifdef NEED_FPUTS_PROTO - int fputs(const char *s, FILE *stream); +int fputs(const char *s, FILE *stream); #endif #ifdef NEED_GETPEERNAME_PROTO - int getpeername(socket_t s, struct sockaddr *name, int *namelen); +int getpeername(socket_t s, struct sockaddr *name, int *namelen); #endif #if defined(HAS_RLIMIT) && defined(NEED_GETRLIMIT_PROTO) - int getrlimit(int resource, struct rlimit *rlp); +int getrlimit(int resource, struct rlimit *rlp); #endif #ifdef NEED_GETSOCKNAME_PROTO - int getsockname(socket_t s, struct sockaddr *name, int *namelen); +int getsockname(socket_t s, struct sockaddr *name, int *namelen); #endif #ifdef NEED_GETTIMEOFDAY_PROTO - void gettimeofday(struct timeval *tp, void * ); +void gettimeofday(struct timeval *tp, void * ); #endif #ifdef NEED_HTONL_PROTO - ulong htonl(u_long hostlong); +ulong htonl(u_long hostlong); #endif #ifdef NEED_HTONS_PROTO - u_short htons(u_short hostshort); +u_short htons(u_short hostshort); #endif #if defined(HAVE_INET_ADDR) && defined(NEED_INET_ADDR_PROTO) - unsigned long int inet_addr(const char *cp); +unsigned long int inet_addr(const char *cp); #endif #if defined(HAVE_INET_ATON) && defined(NEED_INET_ATON_PROTO) - int inet_aton(const char *cp, struct in_addr *inp); +int inet_aton(const char *cp, struct in_addr *inp); #endif #ifdef NEED_INET_NTOA_PROTO - char *inet_ntoa(const struct in_addr in); +char *inet_ntoa(const struct in_addr in); #endif #ifdef NEED_LISTEN_PROTO - int listen(socket_t s, int backlog); +int listen(socket_t s, int backlog); #endif #ifdef NEED_NTOHL_PROTO - u_long ntohl(u_long netlong); +u_long ntohl(u_long netlong); #endif #ifdef NEED_PRINTF_PROTO - int printf(char *format, ...); +int printf(char *format, ...); #endif #ifdef NEED_READ_PROTO - ssize_t read(int fildes, void *buf, size_t nbyte); +ssize_t read(int fildes, void *buf, size_t nbyte); #endif #ifdef NEED_SELECT_PROTO - int select(int nfds, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout); +int select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout); #endif #ifdef NEED_SETITIMER_PROTO - int setitimer(int which, const struct itimerval *value, - struct itimerval *ovalue); +int setitimer(int which, const struct itimerval *value, + struct itimerval *ovalue); #endif #if defined(HAS_RLIMIT) && defined(NEED_SETRLIMIT_PROTO) - int setrlimit(int resource, const struct rlimit *rlp); +int setrlimit(int resource, const struct rlimit *rlp); #endif #ifdef NEED_SETSOCKOPT_PROTO - int setsockopt(socket_t s, int level, int optname, const char *optval, - int optlen); +int setsockopt(socket_t s, int level, int optname, const char *optval, + int optlen); #endif #ifdef NEED_SOCKET_PROTO - int socket(int domain, int type, int protocol); +int socket(int domain, int type, int protocol); #endif #ifdef NEED_WRITE_PROTO - ssize_t write(int fildes, const void *buf, size_t nbyte); +ssize_t write(int fildes, const void *buf, size_t nbyte); #endif #endif /* NO_LIBRARY_PROTOTYPES */ diff --git a/src/telnet.h b/src/telnet.h index 63a98b8..ed8a9df 100644 --- a/src/telnet.h +++ b/src/telnet.h @@ -1,14 +1,14 @@ /** * @file telnet.h * Function prototypes, defines and macros to handle socket connections. -* +* * Part of the core tbaMUD source code distribution, which is a derivative -* of, and continuation of, CircleMUD. +* of, and continuation of, CircleMUD. */ /* * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -20,8 +20,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. + * This product includes software developed by the University of + * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. @@ -38,7 +38,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)telnet.h 8.2 (Berkeley) 12/15/93 + * @(#)telnet.h 8.2 (Berkeley) 12/15/93 */ #ifndef _ARPA_TELNET_H @@ -47,205 +47,204 @@ /* * Definitions for the TELNET protocol. */ -#define IAC 255 /* interpret as command: */ -#define DONT 254 /* you are not to use option */ -#define DO 253 /* please, you use option */ -#define WONT 252 /* I won't use option */ -#define WILL 251 /* I will use option */ -#define SB 250 /* interpret as subnegotiation */ -#define GA 249 /* you may reverse the line */ -#define EL 248 /* erase the current line */ -#define EC 247 /* erase the current character */ -#define AYT 246 /* are you there */ -#define AO 245 /* abort output--but let prog finish */ -#define IP 244 /* interrupt process--permanently */ -#define BREAK 243 /* break */ -#define DM 242 /* data mark--for connect. cleaning */ -#define NOP 241 /* nop */ -#define SE 240 /* end sub negotiation */ +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ #define EOR 239 /* end of record (transparent mode) */ -#define ABORT 238 /* Abort process */ -#define SUSP 237 /* Suspend process */ -#define xEOF 236 /* End of file: EOF is already used... */ +#define ABORT 238 /* Abort process */ +#define SUSP 237 /* Suspend process */ +#define xEOF 236 /* End of file: EOF is already used... */ -#define SYNCH 242 /* for telfunc calls */ +#define SYNCH 242 /* for telfunc calls */ #ifdef TELCMDS char *telcmds[] = { - "EOF", "SUSP", "ABORT", "EOR", - "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", - "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, + "EOF", "SUSP", "ABORT", "EOR", + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, }; #else extern char *telcmds[]; #endif -#define TELCMD_FIRST xEOF -#define TELCMD_LAST IAC -#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ - (unsigned int)(x) >= TELCMD_FIRST) -#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] +#define TELCMD_FIRST xEOF +#define TELCMD_LAST IAC +#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && (unsigned int)(x) >= TELCMD_FIRST) +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] /* telnet options */ -#define TELOPT_BINARY 0 /* 8-bit data path */ -#define TELOPT_ECHO 1 /* echo */ -#define TELOPT_RCP 2 /* prepare to reconnect */ -#define TELOPT_SGA 3 /* suppress go ahead */ -#define TELOPT_NAMS 4 /* approximate message size */ -#define TELOPT_STATUS 5 /* give status */ -#define TELOPT_TM 6 /* timing mark */ -#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ -#define TELOPT_NAOL 8 /* negotiate about output line width */ -#define TELOPT_NAOP 9 /* negotiate about output page size */ -#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ -#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ -#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ -#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ -#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ -#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ -#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ -#define TELOPT_XASCII 17 /* extended ascic character set */ -#define TELOPT_LOGOUT 18 /* force logout */ -#define TELOPT_BM 19 /* byte macro */ -#define TELOPT_DET 20 /* data entry terminal */ -#define TELOPT_SUPDUP 21 /* supdup protocol */ -#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ -#define TELOPT_SNDLOC 23 /* send location */ -#define TELOPT_TTYPE 24 /* terminal type */ -#define TELOPT_EOR 25 /* end or record */ -#define TELOPT_TUID 26 /* TACACS user identification */ -#define TELOPT_OUTMRK 27 /* output marking */ -#define TELOPT_TTYLOC 28 /* terminal location number */ -#define TELOPT_3270REGIME 29 /* 3270 regime */ -#define TELOPT_X3PAD 30 /* X.3 PAD */ -#define TELOPT_NAWS 31 /* window size */ -#define TELOPT_TSPEED 32 /* terminal speed */ -#define TELOPT_LFLOW 33 /* remote flow control */ -#define TELOPT_LINEMODE 34 /* Linemode option */ -#define TELOPT_XDISPLOC 35 /* X Display Location */ -#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ -#define TELOPT_AUTHENTICATION 37/* Authenticate */ -#define TELOPT_ENCRYPT 38 /* Encryption option */ -#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ -#define TELOPT_EXOPL 255 /* extended-options-list */ +#define TELOPT_BINARY 0 /* 8-bit data path */ +#define TELOPT_ECHO 1 /* echo */ +#define TELOPT_RCP 2 /* prepare to reconnect */ +#define TELOPT_SGA 3 /* suppress go ahead */ +#define TELOPT_NAMS 4 /* approximate message size */ +#define TELOPT_STATUS 5 /* give status */ +#define TELOPT_TM 6 /* timing mark */ +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define TELOPT_NAOL 8 /* negotiate about output line width */ +#define TELOPT_NAOP 9 /* negotiate about output page size */ +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_LOGOUT 18 /* force logout */ +#define TELOPT_BM 19 /* byte macro */ +#define TELOPT_DET 20 /* data entry terminal */ +#define TELOPT_SUPDUP 21 /* supdup protocol */ +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define TELOPT_SNDLOC 23 /* send location */ +#define TELOPT_TTYPE 24 /* terminal type */ +#define TELOPT_EOR 25 /* end or record */ +#define TELOPT_TUID 26 /* TACACS user identification */ +#define TELOPT_OUTMRK 27 /* output marking */ +#define TELOPT_TTYLOC 28 /* terminal location number */ +#define TELOPT_3270REGIME 29 /* 3270 regime */ +#define TELOPT_X3PAD 30 /* X.3 PAD */ +#define TELOPT_NAWS 31 /* window size */ +#define TELOPT_TSPEED 32 /* terminal speed */ +#define TELOPT_LFLOW 33 /* remote flow control */ +#define TELOPT_LINEMODE 34 /* Linemode option */ +#define TELOPT_XDISPLOC 35 /* X Display Location */ +#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ +#define TELOPT_AUTHENTICATION 37/* Authenticate */ +#define TELOPT_ENCRYPT 38 /* Encryption option */ +#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ +#define TELOPT_EXOPL 255 /* extended-options-list */ -#define NTELOPTS (1+TELOPT_NEW_ENVIRON) +#define NTELOPTS (1+TELOPT_NEW_ENVIRON) #ifdef TELOPTS char *telopts[NTELOPTS+1] = { - "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", - "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", - "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", - "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", - "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", - "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", - "TACACS UID", "OUTPUT MARKING", "TTYLOC", - "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", - "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", - "ENCRYPT", "NEW-ENVIRON", - 0, + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", + "TACACS UID", "OUTPUT MARKING", "TTYLOC", + "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", + "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", + "ENCRYPT", "NEW-ENVIRON", + 0, }; -#define TELOPT_FIRST TELOPT_BINARY -#define TELOPT_LAST TELOPT_NEW_ENVIRON -#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) -#define TELOPT(x) telopts[(x)-TELOPT_FIRST] +#define TELOPT_FIRST TELOPT_BINARY +#define TELOPT_LAST TELOPT_NEW_ENVIRON +#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) +#define TELOPT(x) telopts[(x)-TELOPT_FIRST] #endif /* sub-option qualifiers */ -#define TELQUAL_IS 0 /* option is... */ -#define TELQUAL_SEND 1 /* send option */ -#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ -#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ -#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ +#define TELQUAL_IS 0 /* option is... */ +#define TELQUAL_SEND 1 /* send option */ +#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ +#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ +#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ -#define LFLOW_OFF 0 /* Disable remote flow control */ -#define LFLOW_ON 1 /* Enable remote flow control */ -#define LFLOW_RESTART_ANY 2 /* Restart output on any char */ -#define LFLOW_RESTART_XON 3 /* Restart output only on XON */ +#define LFLOW_OFF 0 /* Disable remote flow control */ +#define LFLOW_ON 1 /* Enable remote flow control */ +#define LFLOW_RESTART_ANY 2 /* Restart output on any char */ +#define LFLOW_RESTART_XON 3 /* Restart output only on XON */ /* * LINEMODE suboptions */ -#define LM_MODE 1 -#define LM_FORWARDMASK 2 -#define LM_SLC 3 +#define LM_MODE 1 +#define LM_FORWARDMASK 2 +#define LM_SLC 3 -#define MODE_EDIT 0x01 -#define MODE_TRAPSIG 0x02 -#define MODE_ACK 0x04 -#define MODE_SOFT_TAB 0x08 -#define MODE_LIT_ECHO 0x10 +#define MODE_EDIT 0x01 +#define MODE_TRAPSIG 0x02 +#define MODE_ACK 0x04 +#define MODE_SOFT_TAB 0x08 +#define MODE_LIT_ECHO 0x10 -#define MODE_MASK 0x1f +#define MODE_MASK 0x1f /* Not part of protocol, but needed to simplify things... */ -#define MODE_FLOW 0x0100 -#define MODE_ECHO 0x0200 -#define MODE_INBIN 0x0400 -#define MODE_OUTBIN 0x0800 -#define MODE_FORCE 0x1000 +#define MODE_FLOW 0x0100 +#define MODE_ECHO 0x0200 +#define MODE_INBIN 0x0400 +#define MODE_OUTBIN 0x0800 +#define MODE_FORCE 0x1000 -#define SLC_SYNCH 1 -#define SLC_BRK 2 -#define SLC_IP 3 -#define SLC_AO 4 -#define SLC_AYT 5 -#define SLC_EOR 6 -#define SLC_ABORT 7 -#define SLC_EOF 8 -#define SLC_SUSP 9 -#define SLC_EC 10 -#define SLC_EL 11 -#define SLC_EW 12 -#define SLC_RP 13 -#define SLC_LNEXT 14 -#define SLC_XON 15 -#define SLC_XOFF 16 -#define SLC_FORW1 17 -#define SLC_FORW2 18 +#define SLC_SYNCH 1 +#define SLC_BRK 2 +#define SLC_IP 3 +#define SLC_AO 4 +#define SLC_AYT 5 +#define SLC_EOR 6 +#define SLC_ABORT 7 +#define SLC_EOF 8 +#define SLC_SUSP 9 +#define SLC_EC 10 +#define SLC_EL 11 +#define SLC_EW 12 +#define SLC_RP 13 +#define SLC_LNEXT 14 +#define SLC_XON 15 +#define SLC_XOFF 16 +#define SLC_FORW1 17 +#define SLC_FORW2 18 -#define NSLC 18 +#define NSLC 18 /* * For backwards compatability, we define SLC_NAMES to be the * list of names if SLC_NAMES is not defined. */ -#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ - "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ - "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, -#ifdef SLC_NAMES +#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ + "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, +#ifdef SLC_NAMES char *slc_names[] = { - SLC_NAMELIST + SLC_NAMELIST }; #else extern char *slc_names[]; -#define SLC_NAMES SLC_NAMELIST +#define SLC_NAMES SLC_NAMELIST #endif -#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) -#define SLC_NAME(x) slc_names[x] +#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) +#define SLC_NAME(x) slc_names[x] -#define SLC_NOSUPPORT 0 -#define SLC_CANTCHANGE 1 -#define SLC_VARIABLE 2 -#define SLC_DEFAULT 3 -#define SLC_LEVELBITS 0x03 +#define SLC_NOSUPPORT 0 +#define SLC_CANTCHANGE 1 +#define SLC_VARIABLE 2 +#define SLC_DEFAULT 3 +#define SLC_LEVELBITS 0x03 -#define SLC_FUNC 0 -#define SLC_FLAGS 1 -#define SLC_VALUE 2 +#define SLC_FUNC 0 +#define SLC_FLAGS 1 +#define SLC_VALUE 2 -#define SLC_ACK 0x80 -#define SLC_FLUSHIN 0x40 -#define SLC_FLUSHOUT 0x20 +#define SLC_ACK 0x80 +#define SLC_FLUSHIN 0x40 +#define SLC_FLUSHOUT 0x20 -#define OLD_ENV_VAR 1 -#define OLD_ENV_VALUE 0 -#define NEW_ENV_VAR 0 -#define NEW_ENV_VALUE 1 -#define ENV_ESC 2 -#define ENV_USERVAR 3 +#define OLD_ENV_VAR 1 +#define OLD_ENV_VALUE 0 +#define NEW_ENV_VAR 0 +#define NEW_ENV_VALUE 1 +#define ENV_ESC 2 +#define ENV_USERVAR 3 /* * AUTHENTICATION suboptions @@ -254,64 +253,64 @@ extern char *slc_names[]; /* * Who is authenticating who ... */ -#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ -#define AUTH_WHO_SERVER 1 /* Server authenticating client */ -#define AUTH_WHO_MASK 1 +#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ +#define AUTH_WHO_SERVER 1 /* Server authenticating client */ +#define AUTH_WHO_MASK 1 /* * amount of authentication done */ -#define AUTH_HOW_ONE_WAY 0 -#define AUTH_HOW_MUTUAL 2 -#define AUTH_HOW_MASK 2 +#define AUTH_HOW_ONE_WAY 0 +#define AUTH_HOW_MUTUAL 2 +#define AUTH_HOW_MASK 2 -#define AUTHTYPE_NULL 0 -#define AUTHTYPE_KERBEROS_V4 1 -#define AUTHTYPE_KERBEROS_V5 2 -#define AUTHTYPE_SPX 3 -#define AUTHTYPE_MINK 4 -#define AUTHTYPE_CNT 5 +#define AUTHTYPE_NULL 0 +#define AUTHTYPE_KERBEROS_V4 1 +#define AUTHTYPE_KERBEROS_V5 2 +#define AUTHTYPE_SPX 3 +#define AUTHTYPE_MINK 4 +#define AUTHTYPE_CNT 5 -#define AUTHTYPE_TEST 99 +#define AUTHTYPE_TEST 99 -#ifdef AUTH_NAMES +#ifdef AUTH_NAMES char *authtype_names[] = { - "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, + "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, }; #else extern char *authtype_names[]; #endif -#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) -#define AUTHTYPE_NAME(x) authtype_names[x] +#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) +#define AUTHTYPE_NAME(x) authtype_names[x] /* * ENCRYPTion suboptions */ -#define ENCRYPT_IS 0 /* I pick encryption type ... */ -#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ -#define ENCRYPT_REPLY 2 /* Initial setup response */ -#define ENCRYPT_START 3 /* Am starting to send encrypted */ -#define ENCRYPT_END 4 /* Am ending encrypted */ -#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ -#define ENCRYPT_REQEND 6 /* Request you send encrypting */ -#define ENCRYPT_ENC_KEYID 7 -#define ENCRYPT_DEC_KEYID 8 -#define ENCRYPT_CNT 9 +#define ENCRYPT_IS 0 /* I pick encryption type ... */ +#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ +#define ENCRYPT_REPLY 2 /* Initial setup response */ +#define ENCRYPT_START 3 /* Am starting to send encrypted */ +#define ENCRYPT_END 4 /* Am ending encrypted */ +#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ +#define ENCRYPT_REQEND 6 /* Request you send encrypting */ +#define ENCRYPT_ENC_KEYID 7 +#define ENCRYPT_DEC_KEYID 8 +#define ENCRYPT_CNT 9 -#define ENCTYPE_ANY 0 -#define ENCTYPE_DES_CFB64 1 -#define ENCTYPE_DES_OFB64 2 -#define ENCTYPE_CNT 3 +#define ENCTYPE_ANY 0 +#define ENCTYPE_DES_CFB64 1 +#define ENCTYPE_DES_OFB64 2 +#define ENCTYPE_CNT 3 -#ifdef ENCRYPT_NAMES +#ifdef ENCRYPT_NAMES char *encrypt_names[] = { - "IS", "SUPPORT", "REPLY", "START", "END", - "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", - 0, + "IS", "SUPPORT", "REPLY", "START", "END", + "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", + 0, }; char *enctype_names[] = { - "ANY", "DES_CFB64", "DES_OFB64", 0, + "ANY", "DES_CFB64", "DES_OFB64", 0, }; #else extern char *encrypt_names[]; @@ -319,9 +318,9 @@ extern char *enctype_names[]; #endif -#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) -#define ENCRYPT_NAME(x) encrypt_names[x] +#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) +#define ENCRYPT_NAME(x) encrypt_names[x] -#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) -#define ENCTYPE_NAME(x) enctype_names[x] +#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) +#define ENCTYPE_NAME(x) enctype_names[x] #endif /* _ARPA_TELNET_H */ diff --git a/src/utils.h b/src/utils.h index d02cd2b..9bcf35e 100644 --- a/src/utils.h +++ b/src/utils.h @@ -29,10 +29,10 @@ /* external declarations and prototypes */ /** direct all log() references to basic_mud_log() function. */ -#define log basic_mud_log +#define log basic_mud_log /** Standard line size, used for many string limits. */ -#define READ_SIZE 256 +#define READ_SIZE 256 /* Public functions made available from utils.c. Documentation for all functions * are made available with the function definition. */ @@ -40,10 +40,10 @@ void basic_mud_log(const char *format, ...) __attribute__ ((format (printf, 1, 2 void basic_mud_vlog(const char *format, va_list args); int touch(const char *path); void mudlog(int type, int level, int file, const char *str, ...) __attribute__ ((format (printf, 4, 5))); -int rand_number(int from, int to); -int dice(int number, int size); -size_t sprintbit(bitvector_t vektor, const char *names[], char *result, size_t reslen); -size_t sprinttype(int type, const char *names[], char *result, size_t reslen); +int rand_number(int from, int to); +int dice(int number, int size); +size_t sprintbit(bitvector_t vektor, const char *names[], char *result, size_t reslen); +size_t sprinttype(int type, const char *names[], char *result, size_t reslen); void sprintbitarray(int bitvector[], const char *names[], int maxar, char *result); int get_line(FILE *fl, char *buf); int get_filename(char *filename, size_t fbufsize, int mode, const char *orig_name); @@ -84,10 +84,10 @@ void weather_and_time(int mode); /* Only provide our versions if one isn't in the C library. These macro names * will be defined by sysdep.h if a strcasecmp or stricmp exists. */ #ifndef str_cmp -int str_cmp(const char *arg1, const char *arg2); +int str_cmp(const char *arg1, const char *arg2); #endif #ifndef strn_cmp -int strn_cmp(const char *arg1, const char *arg2, int n); +int strn_cmp(const char *arg1, const char *arg2, int n); #endif /* random functions in random.c */ @@ -108,30 +108,30 @@ int MIN(int a, int b); char *CAP(char *txt); /* Followers */ -int num_followers_charmed(struct char_data *ch); -void die_follower(struct char_data *ch); -void add_follower(struct char_data *ch, struct char_data *leader); -void stop_follower(struct char_data *ch); -bool circle_follow(struct char_data *ch, struct char_data *victim); +int num_followers_charmed(struct char_data *ch); +void die_follower(struct char_data *ch); +void add_follower(struct char_data *ch, struct char_data *leader); +void stop_follower(struct char_data *ch); +bool circle_follow(struct char_data *ch, struct char_data *victim); /* in act.informative.c */ -void look_at_room(struct char_data *ch, int mode); -void add_history(struct char_data *ch, char *msg, int type); +void look_at_room(struct char_data *ch, int mode); +void add_history(struct char_data *ch, char *msg, int type); /* in act.movmement.c */ -int do_simple_move(struct char_data *ch, int dir, int following); -int perform_move(struct char_data *ch, int dir, int following); +int do_simple_move(struct char_data *ch, int dir, int following); +int perform_move(struct char_data *ch, int dir, int following); /* in limits.c */ -int mana_gain(struct char_data *ch); -int hit_gain(struct char_data *ch); -int move_gain(struct char_data *ch); -void set_title(struct char_data *ch, char *title); -void gain_exp(struct char_data *ch, int gain); -void gain_exp_regardless(struct char_data *ch, int gain); -void gain_condition(struct char_data *ch, int condition, int value); -void point_update(void); -void update_pos(struct char_data *victim); +int mana_gain(struct char_data *ch); +int hit_gain(struct char_data *ch); +int move_gain(struct char_data *ch); +void set_title(struct char_data *ch, char *title); +void gain_exp(struct char_data *ch, int gain); +void gain_exp_regardless(struct char_data *ch, int gain); +void gain_condition(struct char_data *ch, int condition, int value); +void point_update(void); +void update_pos(struct char_data *victim); void run_autowiz(void); int increase_gold(struct char_data *ch, int amt); int decrease_gold(struct char_data *ch, int amt); @@ -152,10 +152,10 @@ void char_from_furniture(struct char_data *ch); /* various constants */ /* defines for mudlog() */ -#define OFF 0 /**< Receive no mudlog messages. */ -#define BRF 1 /**< Receive only the most important mudlog messages. */ -#define NRM 2 /**< Receive the standard mudlog messages. */ -#define CMP 3 /**< Receive every mudlog message. */ +#define OFF 0 /**< Receive no mudlog messages. */ +#define BRF 1 /**< Receive only the most important mudlog messages. */ +#define NRM 2 /**< Receive the standard mudlog messages. */ +#define CMP 3 /**< Receive every mudlog message. */ /* get_filename() types of files to open */ #define CRASH_FILE 0 /**< Open up a player crash save file */ @@ -166,32 +166,32 @@ void char_from_furniture(struct char_data *ch); #define MAX_FILES 4 /**< Max number of files types vailable */ /* breadth-first searching for graph function (tracking, etc) */ -#define BFS_ERROR (-1) /**< Error in the search. */ -#define BFS_ALREADY_THERE (-2) /**< Area traversed already. */ -#define BFS_NO_PATH (-3) /**< No path through here. */ +#define BFS_ERROR (-1) /**< Error in the search. */ +#define BFS_ALREADY_THERE (-2) /**< Area traversed already. */ +#define BFS_NO_PATH (-3) /**< No path through here. */ /** Number of real life seconds per mud hour. * @todo The definitions based on SECS_PER_MUD_HOUR should be configurable. * See act.informative.c and utils.c for other places to change. */ -#define SECS_PER_MUD_HOUR 75 +#define SECS_PER_MUD_HOUR 75 /** Real life seconds in one mud day. * Current calculation = 30 real life minutes. */ -#define SECS_PER_MUD_DAY (24*SECS_PER_MUD_HOUR) +#define SECS_PER_MUD_DAY (24*SECS_PER_MUD_HOUR) /** Real life seconds per mud month. * Current calculation = 17.5 real life hours */ -#define SECS_PER_MUD_MONTH (35*SECS_PER_MUD_DAY) +#define SECS_PER_MUD_MONTH (35*SECS_PER_MUD_DAY) /** Real life seconds per mud month. * Current calculation ~= 12.4 real life days */ -#define SECS_PER_MUD_YEAR (17*SECS_PER_MUD_MONTH) +#define SECS_PER_MUD_YEAR (17*SECS_PER_MUD_MONTH) /** The number of seconds in a real minute. */ -#define SECS_PER_REAL_MIN 60 +#define SECS_PER_REAL_MIN 60 /** The number of seconds in a real hour. */ -#define SECS_PER_REAL_HOUR (60*SECS_PER_REAL_MIN) +#define SECS_PER_REAL_HOUR (60*SECS_PER_REAL_MIN) /** The number of seconds in a real day. */ -#define SECS_PER_REAL_DAY (24*SECS_PER_REAL_HOUR) +#define SECS_PER_REAL_DAY (24*SECS_PER_REAL_HOUR) /** The number of seconds in a real year. */ -#define SECS_PER_REAL_YEAR (365*SECS_PER_REAL_DAY) +#define SECS_PER_REAL_YEAR (365*SECS_PER_REAL_DAY) /* integer utils */ #define URANGE(a, b, c) ((b) < (a) ? (a) : ((b) > (c) ? (c) : (b))) @@ -221,10 +221,10 @@ void char_from_furniture(struct char_data *ch); * @param type The type of memory (int, struct char_data, etc.). * @param number How many of type to make. */ #define CREATE(result, type, number) do {\ - if ((number) * sizeof(type) <= 0) \ - log("SYSERR: Zero bytes or less requested at %s:%d.", __FILE__, __LINE__); \ - if (!((result) = (type *) calloc ((number), sizeof(type)))) \ - { perror("SYSERR: malloc failure"); abort(); } } while(0) + if ((number) * sizeof(type) <= 0) \ + log("SYSERR: Zero bytes or less requested at %s:%d.", __FILE__, __LINE__); \ + if (!((result) = (type *) calloc ((number), sizeof(type)))) \ + { perror("SYSERR: malloc failure"); abort(); } } while(0) /** A realloc based memory reallocation macro. Reminder: realloc can reduce * the size of an array as well as increase it. @@ -233,7 +233,7 @@ void char_from_furniture(struct char_data *ch); * @param number How many of type to make. */ #define RECREATE(result, type, number) do {\ if (!((result) = (type *) realloc ((result), sizeof(type) * (number))))\ - { perror("SYSERR: realloc failure"); abort(); } } while(0) + { perror("SYSERR: realloc failure"); abort(); } } while(0) /** Remove an item from a linked list and reset the links. * If item is at the list head, change the head, else traverse the @@ -246,16 +246,16 @@ void char_from_furniture(struct char_data *ch); * @param head Pointer to the head of the linked list. * @param next The variable name pointing to the next in the list. * */ -#define REMOVE_FROM_LIST(item, head, next) \ - if ((item) == (head)) \ - head = (item)->next; \ - else { \ - temp = head; \ +#define REMOVE_FROM_LIST(item, head, next) \ + if ((item) == (head)) \ + head = (item)->next; \ + else { \ + temp = head; \ while (temp && (temp->next != (item))) \ - temp = temp->next; \ - if (temp) \ - temp->next = (item)->next; \ - } \ + temp = temp->next; \ + if (temp) \ + temp->next = (item)->next; \ + } \ /* Connect 'link' to the end of a double-linked list * The new item becomes the last in the linked list, and the last @@ -357,22 +357,22 @@ do \ /** Warn if accessing player_specials on a mob. * @todo Subtle bug in the var reporting, but works well for now. */ #define CHECK_PLAYER_SPECIAL(ch, var) \ - (*(((ch)->player_specials == &dummy_mob) ? (log("SYSERR: Mob using '"#var"' at %s:%d.", __FILE__, __LINE__), &(var)) : &(var))) + (*(((ch)->player_specials == &dummy_mob) ? (log("SYSERR: Mob using '"#var"' at %s:%d.", __FILE__, __LINE__), &(var)) : &(var))) #else -#define CHECK_PLAYER_SPECIAL(ch, var) (var) +#define CHECK_PLAYER_SPECIAL(ch, var) (var) #endif /** The act flags on a mob. Synonomous with PLR_FLAGS. */ -#define MOB_FLAGS(ch) ((ch)->char_specials.saved.act) +#define MOB_FLAGS(ch) ((ch)->char_specials.saved.act) /** Player flags on a PC. Synonomous with MOB_FLAGS. */ -#define PLR_FLAGS(ch) ((ch)->char_specials.saved.act) +#define PLR_FLAGS(ch) ((ch)->char_specials.saved.act) /** Preference flags on a player (not to be used on mobs). */ #define PRF_FLAGS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.pref)) /** Affect flags on the NPC or PC. */ -#define AFF_FLAGS(ch) ((ch)->char_specials.saved.affected_by) +#define AFF_FLAGS(ch) ((ch)->char_specials.saved.affected_by) /** Room flags. * @param loc The real room number. */ -#define ROOM_FLAGS(loc) (world[(loc)].room_flags) +#define ROOM_FLAGS(loc) (world[(loc)].room_flags) /** Zone flags. * @param rnum The real zone number. */ #define ZONE_FLAGS(rnum) (zone_table[(rnum)].zone_flags) @@ -384,16 +384,15 @@ do \ #define ZONE_MAXLVL(rnum) (zone_table[(rnum)].max_level) /** References the routine element for a spell. Currently unused. */ -#define SPELL_ROUTINES(spl) (spell_info[spl].routines) +#define SPELL_ROUTINES(spl) (spell_info[spl].routines) /* IS_MOB() acts as a VALID_MOB_RNUM()-like function.*/ /** 1 if the character has the NPC bit set, 0 if the character does not. * Used to prevents NPCs and mobs from doing things they shouldn't, even * when mobs are possessed or charmed by a player. */ -#define IS_NPC(ch) (IS_SET_AR(MOB_FLAGS(ch), MOB_ISNPC)) +#define IS_NPC(ch) (IS_SET_AR(MOB_FLAGS(ch), MOB_ISNPC)) /** 1 if the character is a real NPC, 0 if the character is not. */ -#define IS_MOB(ch) (IS_NPC(ch) && GET_MOB_RNUM(ch) <= top_of_mobt && \ - GET_MOB_RNUM(ch) != NOBODY) +#define IS_MOB(ch) (IS_NPC(ch) && GET_MOB_RNUM(ch) <= top_of_mobt && GET_MOB_RNUM(ch) != NOBODY) /** 1 if ch is flagged an NPC and flag is set in the act bitarray, 0 if not. */ #define MOB_FLAGGED(ch, flag) (IS_NPC(ch) && IS_SET_AR(MOB_FLAGS(ch), (flag))) @@ -437,62 +436,57 @@ do \ /** Return the sector type for the room. If there is no sector type, return * SECT_INSIDE. */ -#define SECT(room) (VALID_ROOM_RNUM(room) ? \ - world[(room)].sector_type : SECT_INSIDE) +#define SECT(room) (VALID_ROOM_RNUM(room) ? world[(room)].sector_type : SECT_INSIDE) /** Return the zone number for this room */ -#define GET_ROOM_ZONE(room) (VALID_ROOM_RNUM(room) ? world[(room)].zone : NOWHERE) +#define GET_ROOM_ZONE(room) (VALID_ROOM_RNUM(room) ? world[(room)].zone : NOWHERE) /** TRUE if the room has no light, FALSE if not. */ -#define IS_DARK(room) room_is_dark((room)) +#define IS_DARK(room) room_is_dark((room)) /** TRUE if the room has light, FALSE if not. */ #define IS_LIGHT(room) (!IS_DARK(room)) /** 1 if this is a valid room number, 0 if not. */ -#define VALID_ROOM_RNUM(rnum) ((rnum) != NOWHERE && (rnum) <= top_of_world) +#define VALID_ROOM_RNUM(rnum) ((rnum) != NOWHERE && (rnum) <= top_of_world) /** The room number if this is a valid room, NOWHERE if it is not */ -#define GET_ROOM_VNUM(rnum) \ - ((room_vnum)(VALID_ROOM_RNUM(rnum) ? world[(rnum)].number : NOWHERE)) +#define GET_ROOM_VNUM(rnum) ((room_vnum)(VALID_ROOM_RNUM(rnum) ? world[(rnum)].number : NOWHERE)) /** Pointer to the room function, NULL if there is not one. */ -#define GET_ROOM_SPEC(room) \ - (VALID_ROOM_RNUM(room) ? world[(room)].func : NULL) +#define GET_ROOM_SPEC(room) (VALID_ROOM_RNUM(room) ? world[(room)].func : NULL) /* char utils */ /** What room is PC/NPC in? */ -#define IN_ROOM(ch) ((ch)->in_room) +#define IN_ROOM(ch) ((ch)->in_room) /** What room was PC/NPC previously in? */ -#define GET_WAS_IN(ch) ((ch)->was_in_room) +#define GET_WAS_IN(ch) ((ch)->was_in_room) /** How old is PC/NPC, at last recorded time? */ #define GET_AGE(ch) (age(ch)->year) /** Name of PC. */ -#define GET_PC_NAME(ch) ((ch)->player.name) +#define GET_PC_NAME(ch) ((ch)->player.name) /** Name of PC or short_descr of NPC. */ #define GET_NAME(ch) (IS_NPC(ch) ? \ - (ch)->player.short_descr : GET_PC_NAME(ch)) + (ch)->player.short_descr : GET_PC_NAME(ch)) /** Title of PC */ #define GET_TITLE(ch) ((ch)->player.title) /** Level of PC or NPC. */ #define GET_LEVEL(ch) ((ch)->player.level) /** Password of PC. */ -#define GET_PASSWD(ch) ((ch)->player.passwd) +#define GET_PASSWD(ch) ((ch)->player.passwd) /** The player file position of PC. */ #define GET_PFILEPOS(ch)((ch)->pfilepos) /** Gets the level of a player even if the player is switched. * @todo Make this the definition of GET_LEVEL. */ -#define GET_REAL_LEVEL(ch) \ - (ch->desc && ch->desc->original ? GET_LEVEL(ch->desc->original) : \ - GET_LEVEL(ch)) +#define GET_REAL_LEVEL(ch) (ch->desc && ch->desc->original ? GET_LEVEL(ch->desc->original) : GET_LEVEL(ch)) /** Class of ch. */ #define GET_CLASS(ch) ((ch)->player.chclass) /** Height of ch. */ -#define GET_HEIGHT(ch) ((ch)->player.height) +#define GET_HEIGHT(ch) ((ch)->player.height) /** Weight of ch. */ -#define GET_WEIGHT(ch) ((ch)->player.weight) +#define GET_WEIGHT(ch) ((ch)->player.weight) /** Sex of ch. */ -#define GET_SEX(ch) ((ch)->player.sex) +#define GET_SEX(ch) ((ch)->player.sex) /** Current strength of ch. */ #define GET_STR(ch) ((ch)->aff_abils.str) @@ -510,34 +504,34 @@ do \ #define GET_CHA(ch) ((ch)->aff_abils.cha) /** Experience points of ch. */ -#define GET_EXP(ch) ((ch)->points.exp) +#define GET_EXP(ch) ((ch)->points.exp) /** Armor class of ch. */ -#define GET_AC(ch) ((ch)->points.armor) +#define GET_AC(ch) ((ch)->points.armor) /** Current hit points (health) of ch. */ -#define GET_HIT(ch) ((ch)->points.hit) +#define GET_HIT(ch) ((ch)->points.hit) /** Maximum hit points of ch. */ -#define GET_MAX_HIT(ch) ((ch)->points.max_hit) +#define GET_MAX_HIT(ch) ((ch)->points.max_hit) /** Current move points (stamina) of ch. */ -#define GET_MOVE(ch) ((ch)->points.move) +#define GET_MOVE(ch) ((ch)->points.move) /** Maximum move points (stamina) of ch. */ #define GET_MAX_MOVE(ch) ((ch)->points.max_move) /** Current mana points (magic) of ch. */ -#define GET_MANA(ch) ((ch)->points.mana) +#define GET_MANA(ch) ((ch)->points.mana) /** Maximum mana points (magic) of ch. */ -#define GET_MAX_MANA(ch) ((ch)->points.max_mana) +#define GET_MAX_MANA(ch) ((ch)->points.max_mana) /** Gold on ch. */ -#define GET_GOLD(ch) ((ch)->points.gold) +#define GET_GOLD(ch) ((ch)->points.gold) /** Gold in bank of ch. */ #define GET_BANK_GOLD(ch) ((ch)->points.bank_gold) /** Current to-hit roll modifier for ch. */ -#define GET_HITROLL(ch) ((ch)->points.hitroll) +#define GET_HITROLL(ch) ((ch)->points.hitroll) /** Current damage roll modifier for ch. */ -#define GET_DAMROLL(ch) ((ch)->points.damroll) +#define GET_DAMROLL(ch) ((ch)->points.damroll) /** Current position (standing, sitting) of ch. */ -#define GET_POS(ch) ((ch)->char_specials.position) +#define GET_POS(ch) ((ch)->char_specials.position) /** Unique ID of ch. */ -#define GET_IDNUM(ch) ((ch)->char_specials.saved.idnum) +#define GET_IDNUM(ch) ((ch)->char_specials.saved.idnum) /** Returns contents of id field from x. */ /** Warning: GET_ID is deprecated and you should use char_script_id, obj_script_id, room_script_id */ /** #define GET_ID(x) ((x)->id) */ @@ -546,97 +540,96 @@ do \ /** Number of items carried by ch. */ #define IS_CARRYING_N(ch) ((ch)->char_specials.carry_items) /** Who or what ch is fighting. */ -#define FIGHTING(ch) ((ch)->char_specials.fighting) +#define FIGHTING(ch) ((ch)->char_specials.fighting) /** Who or what the ch is hunting. */ -#define HUNTING(ch) ((ch)->char_specials.hunting) +#define HUNTING(ch) ((ch)->char_specials.hunting) /** Saving throw i for character ch. */ -#define GET_SAVE(ch, i) ((ch)->char_specials.saved.apply_saving_throw[i]) +#define GET_SAVE(ch, i) ((ch)->char_specials.saved.apply_saving_throw[i]) /** Alignment value for ch. */ #define GET_ALIGNMENT(ch) ((ch)->char_specials.saved.alignment) /** Return condition i (DRUNK, HUNGER, THIRST) of ch. */ -#define GET_COND(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.conditions[(i)])) +#define GET_COND(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.conditions[(i)])) /** The room to load player ch into. */ -#define GET_LOADROOM(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.load_room)) +#define GET_LOADROOM(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.load_room)) /** Number of skill practice sessions remaining for ch. */ -#define GET_PRACTICES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.spells_to_learn)) +#define GET_PRACTICES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.spells_to_learn)) /** Current invisibility level of ch. */ -#define GET_INVIS_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.invis_level)) +#define GET_INVIS_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.invis_level)) /** Current wimpy level of ch. */ -#define GET_WIMP_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.wimp_level)) +#define GET_WIMP_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.wimp_level)) /** Current freeze level (god command) inflicted upon ch. */ -#define GET_FREEZE_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.freeze_level)) +#define GET_FREEZE_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.freeze_level)) /** Current number of bad password attempts at logon. */ -#define GET_BAD_PWS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.bad_pws)) +#define GET_BAD_PWS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.bad_pws)) /** Not used? * @deprecated Should not be used, as the talks field has been removed. */ -#define GET_TALK(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.talks[i])) +#define GET_TALK(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.talks[i])) /** The poofin string for the ch. */ -#define POOFIN(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofin)) +#define POOFIN(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofin)) /** The poofout string for the ch. */ -#define POOFOUT(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofout)) +#define POOFOUT(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofout)) /** The OLC zoon permission for ch. * @deprecated Currently unused? */ -#define GET_OLC_ZONE(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.olc_zone)) +#define GET_OLC_ZONE(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.olc_zone)) /** Currently unused? * @deprecated Currently unused? */ -#define GET_LAST_OLC_TARG(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_targ)) +#define GET_LAST_OLC_TARG(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_targ)) /** Currently unused? * @deprecated Currently unused? */ -#define GET_LAST_OLC_MODE(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_mode)) +#define GET_LAST_OLC_MODE(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_mode)) /** Retrieve command aliases for ch. */ -#define GET_ALIASES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->aliases)) +#define GET_ALIASES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->aliases)) /** Who ch last spoke to with the 'tell' command. */ -#define GET_LAST_TELL(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_tell)) +#define GET_LAST_TELL(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_tell)) /** Get unique session id for ch. */ -#define GET_PREF(ch) ((ch)->pref) +#define GET_PREF(ch) ((ch)->pref) /** Get host name or ip of ch. */ -#define GET_HOST(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->host)) -#define GET_LAST_MOTD(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.lastmotd)) -#define GET_LAST_NEWS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.lastnews)) +#define GET_HOST(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->host)) +#define GET_LAST_MOTD(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.lastmotd)) +#define GET_LAST_NEWS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.lastnews)) /** Get channel history i for ch. */ -#define GET_HISTORY(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.comm_hist[i])) +#define GET_HISTORY(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.comm_hist[i])) /** Return the page length (height) for ch. */ -#define GET_PAGE_LENGTH(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.page_length)) +#define GET_PAGE_LENGTH(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.page_length)) /** Return the page width for ch */ -#define GET_SCREEN_WIDTH(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.screen_width)) +#define GET_SCREEN_WIDTH(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.screen_width)) /* Autoquests data */ /** Return the number of questpoints ch has. */ -#define GET_QUESTPOINTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.questpoints)) +#define GET_QUESTPOINTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.questpoints)) /** Return the current quest that a player has assigned */ -#define GET_QUEST(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.current_quest)) +#define GET_QUEST(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.current_quest)) /** Number of goals completed for this quest. */ -#define GET_QUEST_COUNTER(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_counter)) +#define GET_QUEST_COUNTER(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_counter)) /** Time remaining to complete the quest ch is currently on. */ -#define GET_QUEST_TIME(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_time)) +#define GET_QUEST_TIME(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_time)) /** The number of quests completed by ch. */ -#define GET_NUM_QUESTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.num_completed_quests)) +#define GET_NUM_QUESTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.num_completed_quests)) /** The type of quest ch is currently participating in. */ -#define GET_QUEST_TYPE(ch) (real_quest(GET_QUEST((ch))) != NOTHING ? aquest_table[real_quest(GET_QUEST((ch)))].type : AQ_UNDEFINED ) +#define GET_QUEST_TYPE(ch) (real_quest(GET_QUEST((ch))) != NOTHING ? aquest_table[real_quest(GET_QUEST((ch)))].type : AQ_UNDEFINED ) /** The current skill level of ch for skill i. */ -#define GET_SKILL(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.skills[i])) +#define GET_SKILL(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.skills[i])) /** Copy the current skill level i of ch to pct. */ -#define SET_SKILL(ch, i, pct) do { CHECK_PLAYER_SPECIAL((ch), (ch)->player_specials->saved.skills[i]) = pct; } while(0) +#define SET_SKILL(ch, i, pct) do { CHECK_PLAYER_SPECIAL((ch), (ch)->player_specials->saved.skills[i]) = pct; } while(0) /** The player's default sector type when buildwalking */ #define GET_BUILDWALK_SECTOR(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->buildwalk_sector)) /** Get obj worn in position i on ch. */ -#define GET_EQ(ch, i) ((ch)->equipment[i]) +#define GET_EQ(ch, i) ((ch)->equipment[i]) /** If ch is a mob, return the special function, else return NULL. */ -#define GET_MOB_SPEC(ch) (IS_MOB(ch) ? mob_index[(ch)->nr].func : NULL) +#define GET_MOB_SPEC(ch) (IS_MOB(ch) ? mob_index[(ch)->nr].func : NULL) /** Get the real number of the mob instance. */ -#define GET_MOB_RNUM(mob) ((mob)->nr) +#define GET_MOB_RNUM(mob) ((mob)->nr) /** If mob is a mob, return the virtual number of it. */ -#define GET_MOB_VNUM(mob) (IS_MOB(mob) ? \ - mob_index[GET_MOB_RNUM(mob)].vnum : NOBODY) +#define GET_MOB_VNUM(mob) (IS_MOB(mob) ? mob_index[GET_MOB_RNUM(mob)].vnum : NOBODY) /** Return the default position of ch. */ -#define GET_DEFAULT_POS(ch) ((ch)->mob_specials.default_pos) +#define GET_DEFAULT_POS(ch) ((ch)->mob_specials.default_pos) /** Return the memory of ch. */ -#define MEMORY(ch) ((ch)->mob_specials.memory) +#define MEMORY(ch) ((ch)->mob_specials.memory) /** Return the equivalent strength of ch if ch has level 18 strength. */ #define STRENGTH_APPLY_INDEX(ch) \ @@ -654,8 +647,7 @@ do \ /** Return whether or not ch is awake. */ #define AWAKE(ch) (GET_POS(ch) > POS_SLEEPING) /** Defines if ch can see in general in the dark. */ -#define CAN_SEE_IN_DARK(ch) \ - (AFF_FLAGGED(ch, AFF_INFRAVISION) || (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT))) +#define CAN_SEE_IN_DARK(ch) (AFF_FLAGGED(ch, AFF_INFRAVISION) || (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT))) /** Defines if ch is good. */ #define IS_GOOD(ch) (GET_ALIGNMENT(ch) >= 350) @@ -669,16 +661,16 @@ do \ #define WAIT_STATE(ch, cycle) do { GET_WAIT_STATE(ch) = (cycle); } while(0) /** Old check wait. * @deprecated Use GET_WAIT_STATE */ -#define CHECK_WAIT(ch) ((ch)->wait > 0) +#define CHECK_WAIT(ch) ((ch)->wait > 0) /** Old mob wait check. * @deprecated Use GET_WAIT_STATE */ -#define GET_MOB_WAIT(ch) GET_WAIT_STATE(ch) +#define GET_MOB_WAIT(ch) GET_WAIT_STATE(ch) /** Use this macro to check the wait state of ch. */ -#define GET_WAIT_STATE(ch) ((ch)->wait) +#define GET_WAIT_STATE(ch) ((ch)->wait) /* Descriptor-based utils. */ /** Connected state of d. */ -#define STATE(d) ((d)->connected) +#define STATE(d) ((d)->connected) /** Defines whether d is using an OLC or not. */ #define IS_IN_OLC(d) ((STATE(d) >= FIRST_OLC_STATE) && (STATE(d) <= LAST_OLC_STATE)) @@ -687,62 +679,58 @@ do \ #define IS_PLAYING(d) (IS_IN_OLC(d) || STATE(d) == CON_PLAYING) /** Defines if it is ok to send a message to ch. */ -#define SENDOK(ch) (((ch)->desc || SCRIPT_CHECK((ch), MTRIG_ACT)) && \ - (to_sleeping || AWAKE(ch)) && \ - !PLR_FLAGGED((ch), PLR_WRITING)) +#define SENDOK(ch) (((ch)->desc || SCRIPT_CHECK((ch), MTRIG_ACT)) && \ + (to_sleeping || AWAKE(ch)) && \ + !PLR_FLAGGED((ch), PLR_WRITING)) /* object utils */ /** Check for NOWHERE or the top array index? If using unsigned types, the top * array index will catch everything. If using signed types, NOTHING will * catch the majority of bad accesses. */ -#define VALID_OBJ_RNUM(obj) (GET_OBJ_RNUM(obj) <= top_of_objt && \ - GET_OBJ_RNUM(obj) != NOTHING) +#define VALID_OBJ_RNUM(obj) (GET_OBJ_RNUM(obj) <= top_of_objt && \ + GET_OBJ_RNUM(obj) != NOTHING) /** Level of obj. */ -#define GET_OBJ_LEVEL(obj) ((obj)->obj_flags.level) +#define GET_OBJ_LEVEL(obj) ((obj)->obj_flags.level) /** Type of obj. */ -#define GET_OBJ_TYPE(obj) ((obj)->obj_flags.type_flag) +#define GET_OBJ_TYPE(obj) ((obj)->obj_flags.type_flag) /** Cost of obj. */ -#define GET_OBJ_COST(obj) ((obj)->obj_flags.cost) +#define GET_OBJ_COST(obj) ((obj)->obj_flags.cost) /** Cost per day to rent obj, if rent is turned on. */ -#define GET_OBJ_RENT(obj) ((obj)->obj_flags.cost_per_day) +#define GET_OBJ_RENT(obj) ((obj)->obj_flags.cost_per_day) /** Affect flags on obj. */ -#define GET_OBJ_AFFECT(obj) ((obj)->obj_flags.bitvector) +#define GET_OBJ_AFFECT(obj) ((obj)->obj_flags.bitvector) /** Extra flags bit array on obj. */ -#define GET_OBJ_EXTRA(obj) ((obj)->obj_flags.extra_flags) +#define GET_OBJ_EXTRA(obj) ((obj)->obj_flags.extra_flags) /** Extra flags field bit array field i on obj. */ #define GET_OBJ_EXTRA_AR(obj, i) ((obj)->obj_flags.extra_flags[(i)]) /** Wear flags on obj. */ -#define GET_OBJ_WEAR(obj) ((obj)->obj_flags.wear_flags) +#define GET_OBJ_WEAR(obj) ((obj)->obj_flags.wear_flags) /** Return value val for obj. */ -#define GET_OBJ_VAL(obj, val) ((obj)->obj_flags.value[(val)]) +#define GET_OBJ_VAL(obj, val) ((obj)->obj_flags.value[(val)]) /** Weight of obj. */ -#define GET_OBJ_WEIGHT(obj) ((obj)->obj_flags.weight) +#define GET_OBJ_WEIGHT(obj) ((obj)->obj_flags.weight) /** Current timer of obj. */ -#define GET_OBJ_TIMER(obj) ((obj)->obj_flags.timer) +#define GET_OBJ_TIMER(obj) ((obj)->obj_flags.timer) /** Real number of obj instance. */ -#define GET_OBJ_RNUM(obj) ((obj)->item_number) +#define GET_OBJ_RNUM(obj) ((obj)->item_number) /** Virtual number of obj, or NOTHING if not a real obj. */ -#define GET_OBJ_VNUM(obj) (VALID_OBJ_RNUM(obj) ? \ - obj_index[GET_OBJ_RNUM(obj)].vnum : NOTHING) +#define GET_OBJ_VNUM(obj) (VALID_OBJ_RNUM(obj) ? obj_index[GET_OBJ_RNUM(obj)].vnum : NOTHING) /** Special function attached to obj, or NULL if nothing attached. */ -#define GET_OBJ_SPEC(obj) (VALID_OBJ_RNUM(obj) ? \ - obj_index[GET_OBJ_RNUM(obj)].func : NULL) +#define GET_OBJ_SPEC(obj) (VALID_OBJ_RNUM(obj) ? obj_index[GET_OBJ_RNUM(obj)].func : NULL) /** Defines if an obj is a corpse. */ -#define IS_CORPSE(obj) (GET_OBJ_TYPE(obj) == ITEM_CONTAINER && \ - GET_OBJ_VAL((obj), 3) == 1) +#define IS_CORPSE(obj) (GET_OBJ_TYPE(obj) == ITEM_CONTAINER && GET_OBJ_VAL((obj), 3) == 1) /** Can the obj be worn on body part? */ -#define CAN_WEAR(obj, part) OBJWEAR_FLAGGED((obj), (part)) +#define CAN_WEAR(obj, part) OBJWEAR_FLAGGED((obj), (part)) /** Return short description of obj. */ -#define GET_OBJ_SHORT(obj) ((obj)->short_description) +#define GET_OBJ_SHORT(obj) ((obj)->short_description) /* Compound utilities and other macros. */ /** Used to compute version. To see if the code running is newer than 3.0pl13, * you would use: if _CIRCLEMUD > CIRCLEMUD_VERSION(3,0,13) */ -#define CIRCLEMUD_VERSION(major, minor, patchlevel) \ - (((major) << 16) + ((minor) << 8) + (patchlevel)) +#define CIRCLEMUD_VERSION(major, minor, patchlevel) (((major) << 16) + ((minor) << 8) + (patchlevel)) /** Figures out possessive pronoun for ch. */ #define HSHR(ch) (GET_SEX(ch) ? (GET_SEX(ch)==SEX_MALE ? "his":"her") :"its") @@ -761,7 +749,7 @@ do \ /* Various macros building up to CAN_SEE */ /** Defines if there is enough light for sub to see in. */ -#define LIGHT_OK(sub) (!AFF_FLAGGED(sub, AFF_BLIND) && \ +#define LIGHT_OK(sub) (!AFF_FLAGGED(sub, AFF_BLIND) && \ (IS_LIGHT(IN_ROOM(sub)) || AFF_FLAGGED((sub), AFF_INFRAVISION) || \ GET_LEVEL(sub) >= LVL_IMMORT)) @@ -776,8 +764,7 @@ do \ /** Defines if sub character can see obj character, assuming immortal * and mortal settings. */ -#define IMM_CAN_SEE(sub, obj) \ - (MORT_CAN_SEE(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED(sub, PRF_HOLYLIGHT))) +#define IMM_CAN_SEE(sub, obj) (MORT_CAN_SEE(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED(sub, PRF_HOLYLIGHT))) /** Is obj character the same as sub character? */ #define SELF(sub, obj) ((sub) == (obj)) @@ -789,21 +776,18 @@ do \ /* End of CAN_SEE */ /** Can the sub character see the obj if it is invisible? */ -#define INVIS_OK_OBJ(sub, obj) \ - (!OBJ_FLAGGED((obj), ITEM_INVISIBLE) || AFF_FLAGGED((sub), AFF_DETECT_INVIS)) +#define INVIS_OK_OBJ(sub, obj) (!OBJ_FLAGGED((obj), ITEM_INVISIBLE) || AFF_FLAGGED((sub), AFF_DETECT_INVIS)) /** Is anyone carrying this object and if so, are they visible? */ #define CAN_SEE_OBJ_CARRIER(sub, obj) \ - ((!obj->carried_by || CAN_SEE(sub, obj->carried_by)) && \ + ((!obj->carried_by || CAN_SEE(sub, obj->carried_by)) && \ (!obj->worn_by || CAN_SEE(sub, obj->worn_by))) /** Can sub character see the obj, using mortal only checks? */ -#define MORT_CAN_SEE_OBJ(sub, obj) \ - (LIGHT_OK(sub) && INVIS_OK_OBJ(sub, obj) && CAN_SEE_OBJ_CARRIER(sub, obj)) +#define MORT_CAN_SEE_OBJ(sub, obj) (LIGHT_OK(sub) && INVIS_OK_OBJ(sub, obj) && CAN_SEE_OBJ_CARRIER(sub, obj)) /** Can sub character see the obj, using mortal and immortal checks? */ -#define CAN_SEE_OBJ(sub, obj) \ - (MORT_CAN_SEE_OBJ(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED((sub), PRF_HOLYLIGHT))) +#define CAN_SEE_OBJ(sub, obj) (MORT_CAN_SEE_OBJ(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED((sub), PRF_HOLYLIGHT))) /** Can ch carry obj? */ #define CAN_CARRY_OBJ(ch,obj) \ @@ -820,12 +804,10 @@ do \ /** If vict can see obj, return obj short description, else return * "something". */ -#define OBJS(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? \ - (obj)->short_description : "something") +#define OBJS(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? (obj)->short_description : "something") /** If vict can see obj, return obj name, else return "something". */ -#define OBJN(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? \ - fname((obj)->name) : "something") +#define OBJN(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? fname((obj)->name) : "something") /** Does direction door exist in the same room as ch? */ #define EXIT(ch, door) (world[IN_ROOM(ch)].dir_option[door]) @@ -839,31 +821,27 @@ do \ /** Can ch walk through direction door. */ #define CAN_GO(ch, door) (EXIT(ch,door) && \ - (EXIT(ch,door)->to_room != NOWHERE) && \ - !IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED)) + (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) ) + ((dir) == SOUTHEAST) || ((dir) == SOUTHWEST) ) /** Return the class abbreviation for ch. */ #define CLASS_ABBR(ch) (IS_NPC(ch) ? "--" : class_abbrevs[(int)GET_CLASS(ch)]) /** 1 if ch is magic user class, 0 if not. */ -#define IS_MAGIC_USER(ch) (!IS_NPC(ch) && \ - (GET_CLASS(ch) == CLASS_MAGIC_USER)) +#define IS_MAGIC_USER(ch) (!IS_NPC(ch) && (GET_CLASS(ch) == CLASS_MAGIC_USER)) /** 1 if ch is cleric class, 0 if not. */ -#define IS_CLERIC(ch) (!IS_NPC(ch) && \ - (GET_CLASS(ch) == CLASS_CLERIC)) +#define IS_CLERIC(ch) (!IS_NPC(ch) && (GET_CLASS(ch) == CLASS_CLERIC)) /** 1 if ch is thief class, 0 if not. */ -#define IS_THIEF(ch) (!IS_NPC(ch) && \ - (GET_CLASS(ch) == CLASS_THIEF)) +#define IS_THIEF(ch) (!IS_NPC(ch) && (GET_CLASS(ch) == CLASS_THIEF)) /** 1 if ch is warrior class, 0 if not. */ -#define IS_WARRIOR(ch) (!IS_NPC(ch) && \ - (GET_CLASS(ch) == CLASS_WARRIOR)) +#define IS_WARRIOR(ch) (!IS_NPC(ch) && (GET_CLASS(ch) == CLASS_WARRIOR)) /** Defines if ch is outdoors or not. */ #define OUTSIDE(ch) (!ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS)) @@ -915,11 +893,11 @@ do \ /* defines for fseek */ #ifndef SEEK_SET /** define for fseek */ -#define SEEK_SET 0 +#define SEEK_SET 0 /** define for fseek */ -#define SEEK_CUR 1 +#define SEEK_CUR 1 /** define for fseek */ -#define SEEK_END 2 +#define SEEK_END 2 #endif /* NOCRYPT can be defined by an implementor manually in sysdep.h. CIRCLE_CRYPT diff --git a/src/zmalloc.h b/src/zmalloc.h index 37860a7..0cc0e5d 100644 --- a/src/zmalloc.h +++ b/src/zmalloc.h @@ -1,13 +1,13 @@ /** * @file zmalloc.h * A simple memory allocation monitor, header. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This code was not part of the original CircleMUD distribution. It has been * included in tbaMUD and is attributed to: -* Version 1.1 Copyright 1996, 1998, 1999, 2000 Eric Murray ericm@lne.com +* Version 1.1 Copyright 1996, 1998, 1999, 2000 Eric Murray ericm@lne.com */ #ifndef _ZMALLOC_H_ @@ -20,11 +20,11 @@ void zmalloc_init(void); void zmalloc_check(void); char *zstrdup(const char *, char *, int); -#define malloc(x) zmalloc((x),__FILE__,__LINE__) -#define calloc(n,x) zmalloc((n*x),__FILE__,__LINE__) -#define realloc(r,x) zrealloc((unsigned char *)(r),(x),__FILE__,__LINE__) -#define free(x) zfree((unsigned char *)(x),__FILE__,__LINE__) +#define malloc(x) zmalloc((x),__FILE__,__LINE__) +#define calloc(n,x) zmalloc((n*x),__FILE__,__LINE__) +#define realloc(r,x) zrealloc((unsigned char *)(r),(x),__FILE__,__LINE__) +#define free(x) zfree((unsigned char *)(x),__FILE__,__LINE__) #undef strdup -#define strdup(x) zstrdup((x), __FILE__, __LINE__) +#define strdup(x) zstrdup((x), __FILE__, __LINE__) #endif /* _ZMALLOC_H_ */