diff --git a/src/act.informative.c b/src/act.informative.c index d2604a8..8651908 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -2144,6 +2144,9 @@ void add_history(struct char_data *ch, char *str, int type) struct txt_block *tmp = GET_HISTORY(ch, type); char time_str[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH]; + if (IS_NPC(ch)) + return; + time_t ct = time(0); strftime(time_str, sizeof(time_str), "%H:%M ", localtime(&ct)); diff --git a/src/act.wizard.c b/src/act.wizard.c index 6362864..9a6798f 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -36,6 +36,8 @@ extern int top_of_p_table; extern socket_t mother_desc; extern ush_int port; extern const char *pc_class_types[]; +extern int top_of_p_table; +extern struct player_index_element *player_table; /* external functions */ int level_exp(int chclass, int level); @@ -54,6 +56,7 @@ void Crash_rentsave(struct char_data * ch, int cost); void new_hist_messg(struct descriptor_data *d, const char *msg); void clearMemory(struct char_data *ch); int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg); +struct time_info_data *real_time_passed(time_t t2, time_t t1); /* local functions */ int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg); @@ -113,6 +116,7 @@ ACMD(do_poofs); ACMD(do_copyover); ACMD(do_peace); void mod_llog_entry(struct last_entry *llast,int type); +ACMD(do_plist); int purge_room(room_rnum room) { @@ -169,7 +173,6 @@ ACMD(do_echo) } } - ACMD(do_send) { char arg[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH]; @@ -544,7 +547,6 @@ void list_zone_commands_room(struct char_data *ch, room_vnum rvnum) send_to_char(ch, nrm); if (!count) send_to_char(ch, "None!\r\n"); - } #undef ZOCMD @@ -683,10 +685,8 @@ void do_stat_object(struct char_data *ch, struct obj_data *j) send_to_char(ch, "In room: %d (%s), ", GET_ROOM_VNUM(IN_ROOM(j)), IN_ROOM(j) == NOWHERE ? "Nowhere" : world[IN_ROOM(j)].name); - /* - * NOTE: In order to make it this far, we must already be able to see the - * character holding the object. Therefore, we do not need CAN_SEE(). - */ + /* In order to make it this far, we must already be able to see the character + * holding the object. Therefore, we do not need CAN_SEE(). */ send_to_char(ch, "In object: %s, ", j->in_obj ? j->in_obj->short_description : "None"); send_to_char(ch, "Carried by: %s, ", j->carried_by ? GET_NAME(j->carried_by) : "Nobody"); send_to_char(ch, "Worn by: %s\r\n", j->worn_by ? GET_NAME(j->worn_by) : "Nobody"); @@ -735,8 +735,7 @@ void do_stat_object(struct char_data *ch, struct obj_data *j) case ITEM_NOTE: send_to_char(ch, "Tongue: %d\r\n", GET_OBJ_VAL(j, 0)); break; - case ITEM_KEY: - /* Nothing */ + case ITEM_KEY: /* Nothing */ break; case ITEM_FOOD: send_to_char(ch, "Makes full: %d, Poisoned: %s\r\n", GET_OBJ_VAL(j, 0), YESNO(GET_OBJ_VAL(j, 3))); @@ -751,11 +750,6 @@ void do_stat_object(struct char_data *ch, struct obj_data *j) break; } - /* - * I deleted the "equipment status" code from here because it seemed - * more or less useless and just takes up valuable screen space. - */ - if (j->contains) { int column; @@ -830,7 +824,7 @@ void do_stat_character(struct char_data *ch, struct char_data *k) k->player.hometown, GET_TALK(k, 0), GET_TALK(k, 1), GET_TALK(k, 2), GET_PRACTICES(k), int_app[GET_INT(k)].learn, wis_app[GET_WIS(k)].bonus); - /*. Display OLC zone for immorts .*/ + /* Display OLC zone for immorts. */ if (GET_LEVEL(k) >= LVL_BUILDER) { if (GET_OLC_ZONE(k)==AEDIT_PERMISSION) send_to_char(ch, ", OLC[%sAedit%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); @@ -987,8 +981,8 @@ void do_stat_character(struct char_data *ch, struct char_data *k) send_to_char(ch, "Global Variables:\r\n"); - /* currently, variable context for players is always 0, so it is */ - /* not displayed here. in the future, this might change */ + /* currently, variable context for players is always 0, so it is not + * displayed here. in the future, this might change */ for (tv = k->script->global_vars; tv; tv = tv->next) { if (*(tv->value) == UID_CHAR) { find_uid_name(tv->value, uname, sizeof(uname)); @@ -1141,11 +1135,9 @@ ACMD(do_shutdown) void snoop_check(struct char_data *ch) { - /* This short routine is to ensure that characters that happen - * to be snooping (or snooped) and get advanced/demoted will - * not be snooping/snooped someone of a higher/lower level (and - * thus, not entitled to be snooping. - */ + /* This short routine is to ensure that characters that happen to be snooping + * (or snooped) and get advanced/demoted will not be snooping/snooped someone + * of a higher/lower level (and thus, not entitled to be snooping. */ if (!ch || !ch->desc) return; if (ch->desc->snooping && @@ -1289,15 +1281,11 @@ ACMD(do_return) if (ch->desc && ch->desc->original) { send_to_char(ch, "You return to your original body.\r\n"); - /* - * If someone switched into your original body, disconnect them. - * - JE 2/22/95 - * - * Zmey: here we put someone switched in our body to disconnect state - * but we must also NULL his pointer to our character, otherwise - * close_socket() will damage our character's pointer to our descriptor - * (which is assigned below in this function). 12/17/99 - */ + /* If someone switched into your original body, disconnect them. - JE + * Zmey: here we put someone switched in our body to disconnect state but + * we must also NULL his pointer to our character, otherwise close_socket() + * will damage our character's pointer to our descriptor (which is assigned + * below in this function). */ if (ch->desc->original->desc) { ch->desc->original->desc->character = NULL; STATE(ch->desc->original->desc) = CON_DISCONNECT; @@ -1532,9 +1520,7 @@ ACMD(do_advance) GET_NAME(ch), GET_NAME(victim), newlevel, oldlevel); if (oldlevel >= LVL_IMMORT && newlevel < LVL_IMMORT) { - /* If they are no longer an immortal, let's remove some of the - * nice immortal only flags, shall we? - */ + /* If they are no longer an immortal, remove the immortal only flags. */ REMOVE_BIT(PRF_FLAGS(victim), PRF_LOG1 | PRF_LOG2); REMOVE_BIT(PRF_FLAGS(victim), PRF_NOHASSLE | PRF_HOLYLIGHT | PRF_SHOWVNUMS); run_autowiz(); @@ -1698,29 +1684,21 @@ ACMD(do_dc) return; } - /* We used to just close the socket here using close_socket(), but - * various people pointed out this could cause a crash if you're - * closing the person below you on the descriptor list. Just setting - * to CON_CLOSE leaves things in a massively inconsistent state so I - * had to add this new flag to the descriptor. -je - * - * It is a much more logical extension for a CON_DISCONNECT to be used - * for in-game socket closes and CON_CLOSE for out of game closings. - * This will retain the stability of the close_me hack while being - * neater in appearance. -gg 12/1/97 - * - * For those unlucky souls who actually manage to get disconnected - * by two different immortals in the same 1/10th of a second, we have - * the below 'if' check. -gg 12/17/99 - */ + /* We used to just close the socket here using close_socket(), but various + * people pointed out this could cause a crash if you're closing the person + * below you on the descriptor list. Just setting to CON_CLOSE leaves things + * in a massively inconsistent state so I had to add this new flag to the + * descriptor. -je It is a much more logical extension for a CON_DISCONNECT + * to be used for in-game socket closes and CON_CLOSE for out of game + * closings. This will retain the stability of the close_me hack while being + * neater in appearance. -gg For those unlucky souls who actually manage to + * get disconnected by two different immortals in the same 1/10th of a + * second, we have the below 'if' check. -gg */ if (STATE(d) == CON_DISCONNECT || STATE(d) == CON_CLOSE) send_to_char(ch, "They're already being disconnected.\r\n"); else { - /* - * Remember that we can disconnect people not in the game and - * that rather confuses the code when it expected there to be - * a character context. - */ + /* Remember that we can disconnect people not in the game and that rather + * confuses the code when it expected there to be a character context. */ if (STATE(d) == CON_PLAYING) STATE(d) = CON_DISCONNECT; else @@ -1792,8 +1770,7 @@ ACMD(do_date) last [name] [#] last without arguments displays the last 10 entries. last with a name only displays the 'stock' last entry. - last with a number displays that many entries (combines with name) -*/ + last with a number displays that many entries (combines with name) */ const char *last_array[11] = { "Connect", "Enter Game", @@ -1847,7 +1824,7 @@ struct last_entry *find_llog_entry(int punique, long idnum) { return NULL; } - /* mod_llog_entry assumes that llast is accurate */ +/* mod_llog_entry assumes that llast is accurate */ void mod_llog_entry(struct last_entry *llast,int type) { FILE *fp; struct last_entry mlast; @@ -1864,8 +1841,8 @@ void mod_llog_entry(struct last_entry *llast,int type) { recs = size/sizeof(struct last_entry); - /* we'll search last to first, since it's faster than any thing else - we can do (like searching for the last shutdown/etc..) */ + /* We'll search last to first, since it's faster than any thing else we can + * do (like searching for the last shutdown/etc..) */ for(tmp=recs; tmp > 0; tmp--) { fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR); fread(&mlast,sizeof(struct last_entry),1,fp); @@ -1889,11 +1866,11 @@ void mod_llog_entry(struct last_entry *llast,int type) { fclose(fp); return; } - /*not the one we seek. next */ + /*not the one we seek. next */ } fclose(fp); - /*not found, no problem, quit */ + /*not found, no problem, quit */ return; } @@ -1901,9 +1878,8 @@ void add_llog_entry(struct char_data *ch, int type) { FILE *fp; struct last_entry *llast; - /* so if a char enteres a name, but bad password, otherwise - loses link before he gets a pref assinged, we - won't record it */ + /* so if a char enteres a name, but bad password, otherwise loses link before + * he gets a pref assinged, we won't record it */ if(GET_PREF(ch) <= 0) { return; } @@ -2273,9 +2249,7 @@ ACMD(do_zreset) send_to_char(ch, "You do not have permission to reset this zone. Try %d.\r\n", GET_OLC_ZONE(ch)); } -/* - * General fn for wizcommands of the sort: cmd - */ +/* General fn for wizcommands of the sort: cmd */ ACMD(do_wizutil) { char arg[MAX_INPUT_LENGTH]; @@ -2370,10 +2344,8 @@ ACMD(do_wizutil) break; default: log("SYSERR: Unknown subcmd %d passed to do_wizutil (%s)", subcmd, __FILE__); - /* SYSERR_DESC: - * This is the same as the unhandled case in do_gen_ps(), but this - * function handles 'reroll', 'pardon', 'freeze', etc. - */ + /* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(), + * but this function handles 'reroll', 'pardon', 'freeze', etc. */ break; } save_char(vict); @@ -2381,9 +2353,7 @@ ACMD(do_wizutil) } /* single zone printing fn used by "show zone" so it's not repeated in the - code 3 times ... -je, 4/6/93 */ - -/* FIXME: overflow possible */ + code 3 times ... -je, 4/6/93 FIXME: overflow possible */ size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall) { size_t tmp; @@ -2433,9 +2403,9 @@ size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall) } return snprintf(bufptr, left, - "%3d %-*s%s By: %-10.10s%s Range: %5d-%5d\r\n", zone_table[zone].number, - count_color_chars(zone_table[zone].name)+30, zone_table[zone].name, KNRM, - zone_table[zone].builders, KNRM, zone_table[zone].bot, zone_table[zone].top); + "%3d %-*s%s By: %-10.10s%s Range: %5d-%5d\r\n", zone_table[zone].number, + count_color_chars(zone_table[zone].name)+30, zone_table[zone].name, KNRM, + zone_table[zone].builders, KNRM, zone_table[zone].bot, zone_table[zone].top); } ACMD(do_show) @@ -2692,7 +2662,7 @@ ACMD(do_show) } } -/***************** The do_set function ***********************************/ +/* The do_set function */ #define PC 1 #define NPC 2 @@ -2831,8 +2801,7 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *va } /* NOTE: May not display the exact age specified due to the integer * division used elsewhere in the code. Seems to only happen for - * some values below the starting age (17) anyway. -gg 5/27/98 - */ + * some values below the starting age (17) anyway. -gg 5/27/98 */ vict->player.time.birth = time(0) - ((value - 17) * SECS_PER_MUD_YEAR); break; case 3: /* align */ @@ -3293,10 +3262,7 @@ ACMD(do_links) } } -/**************************************************************************************/ -/* Zone Checker Code below */ -/**************************************************************************************/ - +/* Zone Checker Code below */ /*mob limits*/ #define MAX_DAMROLL_ALLOWED MAX(GET_LEVEL(mob)/5, 1) #define MAX_HITROLL_ALLOWED MAX(GET_LEVEL(mob)/3, 1) @@ -3340,12 +3306,8 @@ struct zcheck_armor { #define MAX_APPLIES_LIMIT 1 /* toggle - is there a limit at all? */ #define CHECK_ITEM_RENT 0 /* do we check for rent cost == 0 ? */ #define CHECK_ITEM_COST 0 /* do we check for item cost == 0 ? */ -/* - Applies limits - !! Very Important: Keep these in the same order as in Structs.h - To ignore an apply, set max_aff to -99. - These will be ignored if MAX_APPLIES_LIMIT = 0 -*/ +/* Applies limits !! Very Important: Keep these in the same order as in Structs.h. + * To ignore an apply, set max_aff to -99. These will be ignored if MAX_APPLIES_LIMIT = 0 */ struct zcheck_affs { int aff_type; /*from Structs.h*/ int min_aff; /*min. allowed value*/ @@ -3415,7 +3377,7 @@ ACMD (do_zcheck) } else send_to_char(ch, "Checking zone %d!\r\n", zone_table[zrnum].number); - /************** Check mobs *****************/ + /* Check mobs */ send_to_char(ch, "Checking Mobs for limits...\r\n"); /*check mobs first*/ @@ -3503,7 +3465,7 @@ ACMD (do_zcheck) len += snprintf(buf + len, sizeof(buf) - len, "- SPEC flag needs to be removed.\r\n"); - /*****ADDITIONAL MOB CHECKS HERE*****/ + /* Additional mob checks.*/ if (found) { send_to_char(ch, "%s[%5d]%s %-30s: %s\r\n", @@ -3516,10 +3478,10 @@ ACMD (do_zcheck) strcpy(buf, ""); found = 0; len = 0; - } /*mob is in zone*/ - } /*check mobs*/ + } /* mob is in zone */ + } /* check mobs */ - /************** Check objects *****************/ + /* Check objects */ send_to_char(ch, "\r\nChecking Objects for limits...\r\n"); for (i=0; ishort_description); send_to_char(ch, buf); @@ -3662,7 +3624,7 @@ ACMD (do_zcheck) } /*object is in zone*/ } /*check objects*/ - /************** Check rooms *****************/ + /* Check rooms */ send_to_char(ch, "\r\nChecking Rooms for limits...\r\n"); for (i=0; i */ ACMD(do_copyover) @@ -4011,11 +3967,6 @@ ACMD(do_copyover) return; } - /* - * Uncomment if you use OasisOLC2.0, this saves all OLC modules: - save_all(); - * - */ sprintf (buf, "\n\r *** COPYOVER by %s - please remain seated!\n\r", GET_NAME(ch)); /* write boot_time as first line in file */ @@ -4281,3 +4232,95 @@ ACMD(do_changelog) fclose(new); send_to_char(ch, "Change added.\r\n"); } + +#define PLIST_FORMAT \ + "plist [minlev[-maxlev]] [-n name] [-d days] [-h hours] [-i] [-m]" + +ACMD(do_plist) +{ + int i, len = 0, count = 0; + char mode, buf[MAX_STRING_LENGTH], name_search[MAX_NAME_LENGTH], time_str[MAX_STRING_LENGTH]; + struct time_info_data time_away; + int low = 0, high = LVL_IMPL, low_day = 0, high_day = 10000, low_hr = 0, high_hr = 24; + + skip_spaces(&argument); + strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */ + name_search[0] = '\0'; + + while (*buf) { + char arg[MAX_INPUT_LENGTH], buf1[MAX_INPUT_LENGTH]; + + half_chop(buf, arg, buf1); + if (isdigit(*arg)) { + if (sscanf(arg, "%d-%d", &low, &high) == 1) + high = low; + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + } else if (*arg == '-') { + mode = *(arg + 1); /* just in case; we destroy arg in the switch */ + switch (mode) { + case 'l': + half_chop(buf1, arg, buf); + sscanf(arg, "%d-%d", &low, &high); + break; + case 'n': + half_chop(buf1, name_search, buf); + break; + case 'i': + strcpy(buf, buf1); + low = LVL_IMMORT; + break; + case 'm': + strcpy(buf, buf1); + high = LVL_IMMORT - 1; + break; + case 'd': + half_chop(buf1, arg, buf); + if (sscanf(arg, "%d-%d", &low_day, &high_day) == 1) + high_day = low_day; + break; + case 'h': + half_chop(buf1, arg, buf); + if (sscanf(arg, "%d-%d", &low_hr, &high_hr) == 1) + high_hr = low_hr; + break; + default: + send_to_char(ch, "%s\r\n", PLIST_FORMAT); + return; + } + } else { + send_to_char(ch, "%s\r\n", PLIST_FORMAT); + return; + } + } + + len = 0; + len += snprintf(buf + len, sizeof(buf) - len, "@W[ Id] (Lv) Name Last@n\r\n" + "%s-----------------------------------------------%s\r\n", CCCYN(ch, C_NRM), + CCNRM(ch, C_NRM)); + + for (i = 0; i <= top_of_p_table; i++) { + if (player_table[i].level < low || player_table[i].level > high) + continue; + + time_away = *real_time_passed(time(0), player_table[i].last); + + if (*name_search && str_cmp(name_search, player_table[i].name)) + continue; + + if (time_away.day > high_day || time_away.day < low_day) + continue; + if (time_away.hours > high_hr || time_away.hours < low_hr) + continue; + + strcpy(time_str, asctime(localtime(&player_table[i].last))); + time_str[strlen(time_str) - 1] = '\0'; + + len += snprintf(buf + len, sizeof(buf) - len, "[%3ld] (%2d) %-12s %s\r\n", + player_table[i].id, player_table[i].level, + CAP(strdup(player_table[i].name)), time_str); + count++; + } + snprintf(buf + len, sizeof(buf) - len, "%s-----------------------------------------------%s\r\n" + "%d players listed.\r\n", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM), count); + page_string(ch->desc, buf, TRUE); +} diff --git a/src/interpreter.c b/src/interpreter.c index 53dea1e..5fedf39 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -160,6 +160,7 @@ ACMD(do_not_here); ACMD(do_order); ACMD(do_page); ACMD(do_peace); +ACMD(do_plist); ACMD(do_pour); ACMD(do_practice); ACMD(do_purge); @@ -255,6 +256,7 @@ cpp_extern const struct command_info cmd_info[] = { { "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 }, @@ -285,6 +287,7 @@ cpp_extern const struct command_info cmd_info[] = { { "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 }, @@ -388,6 +391,7 @@ cpp_extern const struct command_info cmd_info[] = { { "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 }, @@ -458,6 +462,8 @@ cpp_extern const struct command_info cmd_info[] = { { "transfer" , "transfer", POS_SLEEPING, do_trans , LVL_GOD, 0 }, { "trigedit" , "trigedit", POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TRIGEDIT}, { "typo" , "typo" , POS_DEAD , do_gen_write, 0, SCMD_TYPO }, + { "tlist" , "tlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TLIST }, + { "tstat" , "tstat" , POS_DEAD , do_tstat , LVL_BUILDER, 0 }, { "unlock" , "unlock" , POS_SITTING , do_gen_door , 0, SCMD_UNLOCK }, { "ungroup" , "ungroup" , POS_DEAD , do_ungroup , 0, 0 }, @@ -472,6 +478,7 @@ cpp_extern const struct command_info cmd_info[] = { { "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 }, { "wake" , "wake" , POS_SLEEPING, do_wake , 0, 0 }, { "wear" , "wea" , POS_RESTING , do_wear , 0, 0 }, @@ -496,10 +503,6 @@ cpp_extern const struct command_info cmd_info[] = { { "zpurge" , "zpurge" , POS_DEAD , do_zpurge , LVL_BUILDER, 0 }, /* DG trigger commands */ - { "attach" , "attach" , POS_DEAD , do_attach , LVL_BUILDER, 0 }, - { "detach" , "detach" , POS_DEAD , do_detach , LVL_BUILDER, 0 }, - { "tlist" , "tlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TLIST }, - { "tstat" , "tstat" , POS_DEAD , do_tstat , LVL_BUILDER, 0 }, { "masound" , "masound" , POS_DEAD , do_masound , -1, 0 }, { "mkill" , "mkill" , POS_STANDING, do_mkill , -1, 0 }, { "mjunk" , "mjunk" , POS_SITTING , do_mjunk , -1, 0 }, @@ -520,7 +523,6 @@ cpp_extern const struct command_info cmd_info[] = { { "mforget" , "mforget" , POS_DEAD , do_mforget , -1, 0 }, { "mtransform", "mtransform", POS_DEAD , do_mtransform,-1, 0 }, { "mzoneecho", "mzoneecho", POS_DEAD , do_mzoneecho, -1, 0 }, - { "vdelete" , "vdelete" , POS_DEAD , do_vdelete , LVL_BUILDER, 0 }, { "mfollow" , "mfollow" , POS_DEAD , do_mfollow , -1, 0 }, { "\n", "zzzzzzz", 0, 0, 0, 0 } }; /* this must be last */ @@ -550,11 +552,9 @@ const char *reserved[] = "\n" }; -/* - * This is the actual command interpreter called from game_loop() in comm.c +/* This is the actual command interpreter called from game_loop() in comm.c * It makes sure you are the proper level and position to execute the command, - * then calls the appropriate function. - */ + * then calls the appropriate function. */ void command_interpreter(struct char_data *ch, char *argument) { int cmd, length; @@ -568,11 +568,9 @@ void command_interpreter(struct char_data *ch, char *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. - */ + /* 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'; @@ -581,9 +579,7 @@ void command_interpreter(struct char_data *ch, char *argument) 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 */ + * here has been removed. Otherwise, find the command. */ { int cont; /* continue the command checks */ cont = command_wtrigger(ch, arg, line); /* any world triggers ? */ @@ -658,11 +654,7 @@ void command_interpreter(struct char_data *ch, char *argument) ((*complete_cmd_info[cmd].command_pointer) (ch, line, cmd, complete_cmd_info[cmd].subcmd)); } -/************************************************************************** - * Routines to handle aliasing * - **************************************************************************/ - - +/* Routines to handle aliasing. */ struct alias_data *find_alias(struct alias_data *alias_list, char *str) { while (alias_list != NULL) { @@ -676,7 +668,6 @@ struct alias_data *find_alias(struct alias_data *alias_list, char *str) return (NULL); } - void free_alias(struct alias_data *a) { if (a->alias) @@ -686,7 +677,6 @@ void free_alias(struct alias_data *a) free(a); } - /* The interface to the outside world: do_alias */ ACMD(do_alias) { @@ -736,18 +726,16 @@ ACMD(do_alias) a->type = ALIAS_SIMPLE; a->next = GET_ALIASES(ch); GET_ALIASES(ch) = a; -// save_char(ch); + save_char(ch); send_to_char(ch, "Alias ready.\r\n"); } } } -/* - * Valid numeric replacements are only $1 .. $9 (makes parsing a little - * easier, and it's not that much of a limitation anyway.) Also valid - * is "$*", which stands for the entire original line after the alias. - * ";" is used to delimit commands. - */ +/* Valid numeric replacements are only $1 .. $9 (makes parsing a little easier, + * and it's not that much of a limitation anyway.) Also valid is "$*", which + * stands for the entire original line after the alias. ";" is used to delimit + * commands. */ #define NUM_TOKENS 9 void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a) @@ -803,15 +791,11 @@ void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data } } - -/* - * Given a character and a string, perform alias replacement on it. - * +/* Given a character and a string, perform alias replacement on it. * Return values: * 0: String was modified in place; call command_interpreter immediately. * 1: String was _not_ modified in place; rather, the expanded aliases - * have been placed at the front of the character's input queue. - */ + * 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; @@ -845,18 +829,12 @@ int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen) } } +/* Various other parsing utilities. */ - -/*************************************************************************** - * Various other parsing utilities * - **************************************************************************/ - -/* - * searches an array of strings for a target string. "exact" can be - * 0 or non-0, depending on whether or not the match must be exact for - * it to be returned. Returns -1 if not found; 0..n otherwise. Array - * must be terminated with a '\n' so it knows to stop searching. - */ +/* Searches an array of strings for a target string. "exact" can be 0 or non-0, + * depending on whether or not the match must be exact for it to be returned. + * Returns -1 if not found; 0..n otherwise. Array must be terminated with a + * '\n' so it knows to stop searching. */ int search_block(char *arg, const char **list, int exact) { int i, l; @@ -865,8 +843,7 @@ int search_block(char *arg, const char **list, int exact) * 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. - */ + * and if so, just blindly return a '-1' for not found. - ae. */ if (*arg == '!') return (-1); @@ -890,7 +867,6 @@ int search_block(char *arg, const char **list, int exact) return (-1); } - int is_number(const char *str) { while (*str) @@ -900,26 +876,21 @@ int is_number(const char *str) return (1); } -/* - * Function to skip over the leading spaces of a string. - */ +/* Function to skip over the leading spaces of a string. */ void skip_spaces(char **string) { for (; **string && isspace(**string); (*string)++); } -/* - * Given a string, change all instances of double dollar signs ($$) to - * single dollar signs ($). When strings come in, all $'s are changed - * to $$'s to avoid having users be able to crash the system if the - * inputted string is eventually sent to act(). If you are using user - * input to produce screen output AND YOU ARE SURE IT WILL NOT BE SENT - * THROUGH THE act() FUNCTION (i.e., do_gecho, do_title, but NOT do_say), - * you can call delete_doubledollar() to make the output look correct. - * - * Modifies the string in-place. - */ +/* Given a string, change all instances of double dollar signs ($$) to single + * dollar signs ($). When strings come in, all $'s are changed to $$'s to + * avoid having users be able to crash the system if the inputted string is + * eventually sent to act(). If you are using user input to produce screen + * output AND YOU ARE SURE IT WILL NOT BE SENT THROUGH THE act() FUNCTION + * (i.e., do_gecho, do_title, but NOT do_say), you can call + * delete_doubledollar() to make the output look correct. + * Modifies the string in-place. */ char *delete_doubledollar(char *string) { char *ddread, *ddwrite; @@ -942,23 +913,18 @@ char *delete_doubledollar(char *string) return (string); } - int fill_word(char *argument) { return (search_block(argument, fill, TRUE) >= 0); } - int reserved_word(char *argument) { 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. - */ +/* 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; @@ -984,13 +950,8 @@ char *one_argument(char *argument, char *first_arg) return (argument); } - -/* - * one_word is like any_one_arg, except that words in quotes ("") are - * considered one word. - * - * No longer ignores fill words. -dak, 6 Jan 2003. - */ +/* one_word is like any_one_arg, except that words in quotes ("") are considered + * one word. No longer ignores fill words. -dak, 6 Jan 2003. */ char *one_word(char *argument, char *first_arg) { skip_spaces(&argument); @@ -1013,7 +974,6 @@ char *one_word(char *argument, char *first_arg) return (argument); } - /* same as one_argument except that it doesn't ignore fill words */ char *any_one_arg(char *argument, char *first_arg) { @@ -1029,26 +989,15 @@ char *any_one_arg(char *argument, char *first_arg) return (argument); } - -/* - * Same as one_argument except that it takes two args and returns the rest; - * ignores fill words - */ +/* 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)); /* :-) */ } - - -/* - * determine if a given string is an abbreviation of another - * (now works symmetrically -- JE 7/25/94) - * - * that was dumb. it shouldn't be symmetrical. JE 5/1/95 - * - * returns 1 if arg1 is an abbreviation of arg2 - */ +/* 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) @@ -1064,13 +1013,8 @@ int is_abbrev(const char *arg1, const char *arg2) return (0); } - - -/* - * Return first space-delimited token in arg1; remainder of string in arg2. - * - * NOTE: Requires sizeof(arg2) >= sizeof(string) - */ +/* 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; @@ -1080,8 +1024,6 @@ void half_chop(char *string, char *arg1, char *arg2) strcpy(arg2, temp); /* strcpy: OK (documentation) */ } - - /* Used in specprocs, mostly. (Exactly) matches "command" to cmd number */ int find_command(const char *command) { @@ -1094,7 +1036,6 @@ int find_command(const char *command) return (-1); } - int special(struct char_data *ch, int cmd, char *arg) { struct obj_data *i; @@ -1133,13 +1074,7 @@ int special(struct char_data *ch, int cmd, char *arg) return (0); } - - -/* ************************************************************************* -* Stuff for controlling the non-playing sockets (get name, pwd etc) * -************************************************************************* */ - - +/* Stuff for controlling the non-playing sockets (get name, pwd etc). */ /* This function needs to die. */ int _parse_name(char *arg, char *name) { @@ -1156,7 +1091,6 @@ int _parse_name(char *arg, char *name) return (0); } - #define RECON 1 #define USURP 2 #define UNSWITCH 3 @@ -1170,10 +1104,8 @@ int perform_dupe_check(struct descriptor_data *d) 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; @@ -1216,15 +1148,12 @@ int perform_dupe_check(struct descriptor_data *d) } } - /* - * 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). - */ - + /* 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; @@ -1310,24 +1239,20 @@ int enter_player_game (struct descriptor_data *d) room_vnum load_room; reset_char(d->character); - /* - * See if there might be some aliases in the old alias file. - * Only do this if there were no aliases in the pfile. - */ + /* See if there might be some aliases in the old alias file. Only do this + * if there were no aliases in the pfile. */ if (GET_ALIASES(d->character) == NULL) { read_aliases(d->character); - // delete the old file - player will be saved in a second. + /* delete the old file - player will be saved in a second. */ delete_aliases(GET_NAME(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. - */ + /* 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); @@ -1347,9 +1272,9 @@ int enter_player_game (struct descriptor_data *d) /* find_char helper */ add_to_lookup_table(GET_ID(d->character), (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 + /* 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); @@ -1362,7 +1287,6 @@ int enter_player_game (struct descriptor_data *d) return load_result; } - /* deal with newcomers and other non-playing sockets */ void nanny(struct descriptor_data *d, char *arg) { @@ -1388,9 +1312,7 @@ void nanny(struct descriptor_data *d, char *arg) skip_spaces(&arg); - /* - * Quick check for the OLC states. - */ + /* 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) { /* send context-sensitive help if need be */ @@ -1505,15 +1427,13 @@ void nanny(struct descriptor_data *d, char *arg) 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 - */ + /* 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 */ @@ -1716,14 +1636,8 @@ void nanny(struct descriptor_data *d, char *arg) 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. - * - * free(d->character->player.description); - * d->character->player.description = NULL; - */ + /* 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"); @@ -1814,11 +1728,9 @@ void nanny(struct descriptor_data *d, char *arg) } break; - /* - * It's possible, if enough pulses are missed, to kick someone off - * while they are at the password prompt. We'll just defer to let - * the game_loop() axe them. - */ + /* It is possible, if enough pulses are missed, to kick someone off while + * they are at the password prompt. We'll just defer to let the game_loop() + * axe them. */ case CON_CLOSE: break; diff --git a/src/structs.h b/src/structs.h index 29aa2af..f7d55ef 100644 --- a/src/structs.h +++ b/src/structs.h @@ -481,7 +481,7 @@ /* ** MAX_PWD_LENGTH changed from 10 to 30 for ascii test - Sam ** */ #define MAX_PWD_LENGTH 30 #define MAX_TITLE_LENGTH 80 -#define HOST_LENGTH 30 +#define HOST_LENGTH 40 #define PLR_DESC_LENGTH 512 #define MAX_TONGUE 3 #define MAX_SKILLS 200