Added Rhade's plist command, more cleanup of files and comments --Rumble

This commit is contained in:
Rumble 2007-03-14 17:15:06 +00:00
parent 355095bdb6
commit 86568f9d4d
4 changed files with 231 additions and 273 deletions

View file

@ -2144,6 +2144,9 @@ void add_history(struct char_data *ch, char *str, int type)
struct txt_block *tmp = GET_HISTORY(ch, type); struct txt_block *tmp = GET_HISTORY(ch, type);
char time_str[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH]; char time_str[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];
if (IS_NPC(ch))
return;
time_t ct = time(0); time_t ct = time(0);
strftime(time_str, sizeof(time_str), "%H:%M ", localtime(&ct)); strftime(time_str, sizeof(time_str), "%H:%M ", localtime(&ct));

View file

@ -36,6 +36,8 @@ extern int top_of_p_table;
extern socket_t mother_desc; extern socket_t mother_desc;
extern ush_int port; extern ush_int port;
extern const char *pc_class_types[]; extern const char *pc_class_types[];
extern int top_of_p_table;
extern struct player_index_element *player_table;
/* external functions */ /* external functions */
int level_exp(int chclass, int level); 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 new_hist_messg(struct descriptor_data *d, const char *msg);
void clearMemory(struct char_data *ch); void clearMemory(struct char_data *ch);
int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg); 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 */ /* local functions */
int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg); 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_copyover);
ACMD(do_peace); ACMD(do_peace);
void mod_llog_entry(struct last_entry *llast,int type); void mod_llog_entry(struct last_entry *llast,int type);
ACMD(do_plist);
int purge_room(room_rnum room) int purge_room(room_rnum room)
{ {
@ -169,7 +173,6 @@ ACMD(do_echo)
} }
} }
ACMD(do_send) ACMD(do_send)
{ {
char arg[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH]; 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); send_to_char(ch, nrm);
if (!count) if (!count)
send_to_char(ch, "None!\r\n"); send_to_char(ch, "None!\r\n");
} }
#undef ZOCMD #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)), send_to_char(ch, "In room: %d (%s), ", GET_ROOM_VNUM(IN_ROOM(j)),
IN_ROOM(j) == NOWHERE ? "Nowhere" : world[IN_ROOM(j)].name); IN_ROOM(j) == NOWHERE ? "Nowhere" : world[IN_ROOM(j)].name);
/* /* In order to make it this far, we must already be able to see the character
* NOTE: In order to make it this far, we must already be able to see the * holding the object. Therefore, we do not need CAN_SEE(). */
* 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, "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, "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"); 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: case ITEM_NOTE:
send_to_char(ch, "Tongue: %d\r\n", GET_OBJ_VAL(j, 0)); send_to_char(ch, "Tongue: %d\r\n", GET_OBJ_VAL(j, 0));
break; break;
case ITEM_KEY: case ITEM_KEY: /* Nothing */
/* Nothing */
break; break;
case ITEM_FOOD: 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))); 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; 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) { if (j->contains) {
int column; 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), k->player.hometown, GET_TALK(k, 0), GET_TALK(k, 1), GET_TALK(k, 2),
GET_PRACTICES(k), int_app[GET_INT(k)].learn, GET_PRACTICES(k), int_app[GET_INT(k)].learn,
wis_app[GET_WIS(k)].bonus); wis_app[GET_WIS(k)].bonus);
/*. Display OLC zone for immorts .*/ /* Display OLC zone for immorts. */
if (GET_LEVEL(k) >= LVL_BUILDER) { if (GET_LEVEL(k) >= LVL_BUILDER) {
if (GET_OLC_ZONE(k)==AEDIT_PERMISSION) if (GET_OLC_ZONE(k)==AEDIT_PERMISSION)
send_to_char(ch, ", OLC[%sAedit%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); 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"); send_to_char(ch, "Global Variables:\r\n");
/* currently, variable context for players is always 0, so it is */ /* currently, variable context for players is always 0, so it is not
/* not displayed here. in the future, this might change */ * displayed here. in the future, this might change */
for (tv = k->script->global_vars; tv; tv = tv->next) { for (tv = k->script->global_vars; tv; tv = tv->next) {
if (*(tv->value) == UID_CHAR) { if (*(tv->value) == UID_CHAR) {
find_uid_name(tv->value, uname, sizeof(uname)); find_uid_name(tv->value, uname, sizeof(uname));
@ -1141,11 +1135,9 @@ ACMD(do_shutdown)
void snoop_check(struct char_data *ch) void snoop_check(struct char_data *ch)
{ {
/* This short routine is to ensure that characters that happen /* This short routine is to ensure that characters that happen to be snooping
* to be snooping (or snooped) and get advanced/demoted will * (or snooped) and get advanced/demoted will not be snooping/snooped someone
* not be snooping/snooped someone of a higher/lower level (and * of a higher/lower level (and thus, not entitled to be snooping. */
* thus, not entitled to be snooping.
*/
if (!ch || !ch->desc) if (!ch || !ch->desc)
return; return;
if (ch->desc->snooping && if (ch->desc->snooping &&
@ -1289,15 +1281,11 @@ ACMD(do_return)
if (ch->desc && ch->desc->original) { if (ch->desc && ch->desc->original) {
send_to_char(ch, "You return to your original body.\r\n"); send_to_char(ch, "You return to your original body.\r\n");
/* /* If someone switched into your original body, disconnect them. - JE
* If someone switched into your original body, disconnect them. * Zmey: here we put someone switched in our body to disconnect state but
* - JE 2/22/95 * we must also NULL his pointer to our character, otherwise close_socket()
* * will damage our character's pointer to our descriptor (which is assigned
* Zmey: here we put someone switched in our body to disconnect state * below in this function). */
* 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 (ch->desc->original->desc) { if (ch->desc->original->desc) {
ch->desc->original->desc->character = NULL; ch->desc->original->desc->character = NULL;
STATE(ch->desc->original->desc) = CON_DISCONNECT; STATE(ch->desc->original->desc) = CON_DISCONNECT;
@ -1532,9 +1520,7 @@ ACMD(do_advance)
GET_NAME(ch), GET_NAME(victim), newlevel, oldlevel); GET_NAME(ch), GET_NAME(victim), newlevel, oldlevel);
if (oldlevel >= LVL_IMMORT && newlevel < LVL_IMMORT) { if (oldlevel >= LVL_IMMORT && newlevel < LVL_IMMORT) {
/* If they are no longer an immortal, let's remove some of the /* If they are no longer an immortal, remove the immortal only flags. */
* nice immortal only flags, shall we?
*/
REMOVE_BIT(PRF_FLAGS(victim), PRF_LOG1 | PRF_LOG2); REMOVE_BIT(PRF_FLAGS(victim), PRF_LOG1 | PRF_LOG2);
REMOVE_BIT(PRF_FLAGS(victim), PRF_NOHASSLE | PRF_HOLYLIGHT | PRF_SHOWVNUMS); REMOVE_BIT(PRF_FLAGS(victim), PRF_NOHASSLE | PRF_HOLYLIGHT | PRF_SHOWVNUMS);
run_autowiz(); run_autowiz();
@ -1698,29 +1684,21 @@ ACMD(do_dc)
return; return;
} }
/* We used to just close the socket here using close_socket(), but /* We used to just close the socket here using close_socket(), but various
* various people pointed out this could cause a crash if you're * people pointed out this could cause a crash if you're closing the person
* closing the person below you on the descriptor list. Just setting * below you on the descriptor list. Just setting to CON_CLOSE leaves things
* to CON_CLOSE leaves things in a massively inconsistent state so I * in a massively inconsistent state so I had to add this new flag to the
* had to add this new flag to the descriptor. -je * 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
* It is a much more logical extension for a CON_DISCONNECT to be used * closings. This will retain the stability of the close_me hack while being
* for in-game socket closes and CON_CLOSE for out of game closings. * neater in appearance. -gg For those unlucky souls who actually manage to
* This will retain the stability of the close_me hack while being * get disconnected by two different immortals in the same 1/10th of a
* neater in appearance. -gg 12/1/97 * second, we have the below 'if' check. -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 12/17/99
*/
if (STATE(d) == CON_DISCONNECT || STATE(d) == CON_CLOSE) if (STATE(d) == CON_DISCONNECT || STATE(d) == CON_CLOSE)
send_to_char(ch, "They're already being disconnected.\r\n"); send_to_char(ch, "They're already being disconnected.\r\n");
else { else {
/* /* Remember that we can disconnect people not in the game and that rather
* Remember that we can disconnect people not in the game and * confuses the code when it expected there to be a character context. */
* that rather confuses the code when it expected there to be
* a character context.
*/
if (STATE(d) == CON_PLAYING) if (STATE(d) == CON_PLAYING)
STATE(d) = CON_DISCONNECT; STATE(d) = CON_DISCONNECT;
else else
@ -1792,8 +1770,7 @@ ACMD(do_date)
last [name] [#] last [name] [#]
last without arguments displays the last 10 entries. last without arguments displays the last 10 entries.
last with a name only displays the 'stock' last entry. 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] = { const char *last_array[11] = {
"Connect", "Connect",
"Enter Game", "Enter Game",
@ -1847,7 +1824,7 @@ struct last_entry *find_llog_entry(int punique, long idnum) {
return NULL; 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) { void mod_llog_entry(struct last_entry *llast,int type) {
FILE *fp; FILE *fp;
struct last_entry mlast; struct last_entry mlast;
@ -1864,8 +1841,8 @@ void mod_llog_entry(struct last_entry *llast,int type) {
recs = size/sizeof(struct last_entry); recs = size/sizeof(struct last_entry);
/* we'll search last to first, since it's faster than any thing else /* We'll search last to first, since it's faster than any thing else we can
we can do (like searching for the last shutdown/etc..) */ * do (like searching for the last shutdown/etc..) */
for(tmp=recs; tmp > 0; tmp--) { for(tmp=recs; tmp > 0; tmp--) {
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR); fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
fread(&mlast,sizeof(struct last_entry),1,fp); fread(&mlast,sizeof(struct last_entry),1,fp);
@ -1901,9 +1878,8 @@ void add_llog_entry(struct char_data *ch, int type) {
FILE *fp; FILE *fp;
struct last_entry *llast; struct last_entry *llast;
/* so if a char enteres a name, but bad password, otherwise /* so if a char enteres a name, but bad password, otherwise loses link before
loses link before he gets a pref assinged, we * he gets a pref assinged, we won't record it */
won't record it */
if(GET_PREF(ch) <= 0) { if(GET_PREF(ch) <= 0) {
return; 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)); 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 <player> */
* General fn for wizcommands of the sort: cmd <player>
*/
ACMD(do_wizutil) ACMD(do_wizutil)
{ {
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
@ -2370,10 +2344,8 @@ ACMD(do_wizutil)
break; break;
default: default:
log("SYSERR: Unknown subcmd %d passed to do_wizutil (%s)", subcmd, __FILE__); log("SYSERR: Unknown subcmd %d passed to do_wizutil (%s)", subcmd, __FILE__);
/* SYSERR_DESC: /* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(),
* This is the same as the unhandled case in do_gen_ps(), but this * but this function handles 'reroll', 'pardon', 'freeze', etc. */
* function handles 'reroll', 'pardon', 'freeze', etc.
*/
break; break;
} }
save_char(vict); 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 /* single zone printing fn used by "show zone" so it's not repeated in the
code 3 times ... -je, 4/6/93 */ code 3 times ... -je, 4/6/93 FIXME: overflow possible */
/* FIXME: overflow possible */
size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall) size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall)
{ {
size_t tmp; size_t tmp;
@ -2692,7 +2662,7 @@ ACMD(do_show)
} }
} }
/***************** The do_set function ***********************************/ /* The do_set function */
#define PC 1 #define PC 1
#define NPC 2 #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 /* NOTE: May not display the exact age specified due to the integer
* division used elsewhere in the code. Seems to only happen for * 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); vict->player.time.birth = time(0) - ((value - 17) * SECS_PER_MUD_YEAR);
break; break;
case 3: /* align */ case 3: /* align */
@ -3293,10 +3262,7 @@ ACMD(do_links)
} }
} }
/**************************************************************************************/
/* Zone Checker Code below */ /* Zone Checker Code below */
/**************************************************************************************/
/*mob limits*/ /*mob limits*/
#define MAX_DAMROLL_ALLOWED MAX(GET_LEVEL(mob)/5, 1) #define MAX_DAMROLL_ALLOWED MAX(GET_LEVEL(mob)/5, 1)
#define MAX_HITROLL_ALLOWED MAX(GET_LEVEL(mob)/3, 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 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_RENT 0 /* do we check for rent cost == 0 ? */
#define CHECK_ITEM_COST 0 /* do we check for item 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.
Applies limits * To ignore an apply, set max_aff to -99. These will be ignored if MAX_APPLIES_LIMIT = 0 */
!! 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 { struct zcheck_affs {
int aff_type; /*from Structs.h*/ int aff_type; /*from Structs.h*/
int min_aff; /*min. allowed value*/ int min_aff; /*min. allowed value*/
@ -3415,7 +3377,7 @@ ACMD (do_zcheck)
} else } else
send_to_char(ch, "Checking zone %d!\r\n", zone_table[zrnum].number); 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"); send_to_char(ch, "Checking Mobs for limits...\r\n");
/*check mobs first*/ /*check mobs first*/
@ -3503,7 +3465,7 @@ ACMD (do_zcheck)
len += snprintf(buf + len, sizeof(buf) - len, len += snprintf(buf + len, sizeof(buf) - len,
"- SPEC flag needs to be removed.\r\n"); "- SPEC flag needs to be removed.\r\n");
/*****ADDITIONAL MOB CHECKS HERE*****/ /* Additional mob checks.*/
if (found) { if (found) {
send_to_char(ch, send_to_char(ch,
"%s[%5d]%s %-30s: %s\r\n", "%s[%5d]%s %-30s: %s\r\n",
@ -3516,10 +3478,10 @@ ACMD (do_zcheck)
strcpy(buf, ""); strcpy(buf, "");
found = 0; found = 0;
len = 0; len = 0;
} /*mob is in zone*/ } /* mob is in zone */
} /*check mobs*/ } /* check mobs */
/************** Check objects *****************/ /* Check objects */
send_to_char(ch, "\r\nChecking Objects for limits...\r\n"); send_to_char(ch, "\r\nChecking Objects for limits...\r\n");
for (i=0; i<top_of_objt; i++) { for (i=0; i<top_of_objt; i++) {
if (real_zone_by_thing(obj_index[i].vnum) == zrnum) { /*is object in this zone?*/ if (real_zone_by_thing(obj_index[i].vnum) == zrnum) { /*is object in this zone?*/
@ -3651,7 +3613,7 @@ ACMD (do_zcheck)
if (ext2 && (found = 1)) if (ext2 && (found = 1))
len += snprintf(buf + len, sizeof(buf) - len, len += snprintf(buf + len, sizeof(buf) - len,
"- has unformatted extra description\r\n"); "- has unformatted extra description\r\n");
/*****ADDITIONAL OBJ CHECKS HERE*****/ /* Additional object checks. */
if (found) { if (found) {
send_to_char(ch, "[%5d] %-30s: \r\n", GET_OBJ_VNUM(obj), obj->short_description); send_to_char(ch, "[%5d] %-30s: \r\n", GET_OBJ_VNUM(obj), obj->short_description);
send_to_char(ch, buf); send_to_char(ch, buf);
@ -3662,7 +3624,7 @@ ACMD (do_zcheck)
} /*object is in zone*/ } /*object is in zone*/
} /*check objects*/ } /*check objects*/
/************** Check rooms *****************/ /* Check rooms */
send_to_char(ch, "\r\nChecking Rooms for limits...\r\n"); send_to_char(ch, "\r\nChecking Rooms for limits...\r\n");
for (i=0; i<top_of_world;i++) { for (i=0; i<top_of_world;i++) {
if (world[i].zone==zrnum) { if (world[i].zone==zrnum) {
@ -3744,7 +3706,6 @@ ACMD (do_zcheck)
send_to_char(ch, "More than 1/3 of the rooms are not linked.\r\n"); send_to_char(ch, "More than 1/3 of the rooms are not linked.\r\n");
} }
/**********************************************************************************/
void mob_checkload(struct char_data *ch, mob_vnum mvnum) void mob_checkload(struct char_data *ch, mob_vnum mvnum)
{ {
@ -3933,7 +3894,6 @@ void trg_checkload(struct char_data *ch, trig_vnum tvnum)
mob_proto[i].player.short_descr); mob_proto[i].player.short_descr);
found = 1; found = 1;
} }
} }
for (j = 0; j < top_of_objt; j++) { for (j = 0; j < top_of_objt; j++) {
@ -3947,7 +3907,6 @@ void trg_checkload(struct char_data *ch, trig_vnum tvnum)
obj_proto[j].short_description); obj_proto[j].short_description);
found = 1; found = 1;
} }
} }
for (k = 0;k < top_of_world; k++) { for (k = 0;k < top_of_world; k++) {
@ -3992,11 +3951,8 @@ ACMD(do_checkloadstatus)
trg_checkload(ch, atoi(buf2)); trg_checkload(ch, atoi(buf2));
return; return;
} }
} }
/**************************************************************************************/ /* Zone Checker code above. */
/* Zone Checker code above */
/**************************************************************************************/
/* (c) 1996-97 Erwin S. Andreasen <erwin@pip.dknet.dk> */ /* (c) 1996-97 Erwin S. Andreasen <erwin@pip.dknet.dk> */
ACMD(do_copyover) ACMD(do_copyover)
@ -4011,11 +3967,6 @@ ACMD(do_copyover)
return; 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)); sprintf (buf, "\n\r *** COPYOVER by %s - please remain seated!\n\r", GET_NAME(ch));
/* write boot_time as first line in file */ /* write boot_time as first line in file */
@ -4281,3 +4232,95 @@ ACMD(do_changelog)
fclose(new); fclose(new);
send_to_char(ch, "Change added.\r\n"); 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);
}

View file

@ -160,6 +160,7 @@ ACMD(do_not_here);
ACMD(do_order); ACMD(do_order);
ACMD(do_page); ACMD(do_page);
ACMD(do_peace); ACMD(do_peace);
ACMD(do_plist);
ACMD(do_pour); ACMD(do_pour);
ACMD(do_practice); ACMD(do_practice);
ACMD(do_purge); ACMD(do_purge);
@ -255,6 +256,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "assist" , "as" , POS_FIGHTING, do_assist , 1, 0 }, { "assist" , "as" , POS_FIGHTING, do_assist , 1, 0 },
{ "ask" , "ask" , POS_RESTING , do_spec_comm, 0, SCMD_ASK }, { "ask" , "ask" , POS_RESTING , do_spec_comm, 0, SCMD_ASK },
{ "astat" , "ast" , POS_DEAD , do_astat , 0, 0 }, { "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 }, { "auction" , "auc" , POS_SLEEPING, do_gen_comm , 0, SCMD_AUCTION },
{ "autoexits" , "autoex" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOEXIT }, { "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 }, { "date" , "da" , POS_DEAD , do_date , LVL_IMMORT, SCMD_DATE },
{ "dc" , "dc" , POS_DEAD , do_dc , LVL_GOD, 0 }, { "dc" , "dc" , POS_DEAD , do_dc , LVL_GOD, 0 },
{ "deposit" , "depo" , POS_STANDING, do_not_here , 1, 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 }, { "diagnose" , "diag" , POS_RESTING , do_diagnose , 0, 0 },
{ "dig" , "dig" , POS_DEAD , do_dig , LVL_BUILDER, 0 }, { "dig" , "dig" , POS_DEAD , do_dig , LVL_BUILDER, 0 },
{ "display" , "disp" , POS_DEAD , do_display , 0, 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 }, { "practice" , "pr" , POS_RESTING , do_practice , 1, 0 },
{ "page" , "pag" , POS_DEAD , do_page , 1, 0 }, { "page" , "pag" , POS_DEAD , do_page , 1, 0 },
{ "pardon" , "pardon" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_PARDON }, { "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 }, { "policy" , "pol" , POS_DEAD , do_gen_ps , 0, SCMD_POLICIES },
{ "pour" , "pour" , POS_STANDING, do_pour , 0, SCMD_POUR }, { "pour" , "pour" , POS_STANDING, do_pour , 0, SCMD_POUR },
{ "prompt" , "pro" , POS_DEAD , do_display , 0, 0 }, { "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 }, { "transfer" , "transfer", POS_SLEEPING, do_trans , LVL_GOD, 0 },
{ "trigedit" , "trigedit", POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TRIGEDIT}, { "trigedit" , "trigedit", POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TRIGEDIT},
{ "typo" , "typo" , POS_DEAD , do_gen_write, 0, SCMD_TYPO }, { "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 }, { "unlock" , "unlock" , POS_SITTING , do_gen_door , 0, SCMD_UNLOCK },
{ "ungroup" , "ungroup" , POS_DEAD , do_ungroup , 0, 0 }, { "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 }, { "visible" , "vis" , POS_RESTING , do_visible , 1, 0 },
{ "vnum" , "vnum" , POS_DEAD , do_vnum , LVL_IMMORT, 0 }, { "vnum" , "vnum" , POS_DEAD , do_vnum , LVL_IMMORT, 0 },
{ "vstat" , "vstat" , POS_DEAD , do_vstat , 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 }, { "wake" , "wake" , POS_SLEEPING, do_wake , 0, 0 },
{ "wear" , "wea" , POS_RESTING , do_wear , 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 }, { "zpurge" , "zpurge" , POS_DEAD , do_zpurge , LVL_BUILDER, 0 },
/* DG trigger commands */ /* 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 }, { "masound" , "masound" , POS_DEAD , do_masound , -1, 0 },
{ "mkill" , "mkill" , POS_STANDING, do_mkill , -1, 0 }, { "mkill" , "mkill" , POS_STANDING, do_mkill , -1, 0 },
{ "mjunk" , "mjunk" , POS_SITTING , do_mjunk , -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 }, { "mforget" , "mforget" , POS_DEAD , do_mforget , -1, 0 },
{ "mtransform", "mtransform", POS_DEAD , do_mtransform,-1, 0 }, { "mtransform", "mtransform", POS_DEAD , do_mtransform,-1, 0 },
{ "mzoneecho", "mzoneecho", POS_DEAD , do_mzoneecho, -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 }, { "mfollow" , "mfollow" , POS_DEAD , do_mfollow , -1, 0 },
{ "\n", "zzzzzzz", 0, 0, 0, 0 } }; /* this must be last */ { "\n", "zzzzzzz", 0, 0, 0, 0 } }; /* this must be last */
@ -550,11 +552,9 @@ const char *reserved[] =
"\n" "\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, * 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) void command_interpreter(struct char_data *ch, char *argument)
{ {
int cmd, length; int cmd, length;
@ -568,11 +568,9 @@ void command_interpreter(struct char_data *ch, char *argument)
if (!*argument) if (!*argument)
return; return;
/* /* special case to handle one-character, non-alphanumeric commands; requested
* special case to handle one-character, non-alphanumeric commands; * by many people so "'hi" or ";godnet test" is possible. Patch sent by Eric
* requested by many people so "'hi" or ";godnet test" is possible. * Green and Stefan Wasilewski. */
* Patch sent by Eric Green and Stefan Wasilewski.
*/
if (!isalpha(*argument)) { if (!isalpha(*argument)) {
arg[0] = argument[0]; arg[0] = argument[0];
arg[1] = '\0'; arg[1] = '\0';
@ -581,9 +579,7 @@ void command_interpreter(struct char_data *ch, char *argument)
line = any_one_arg(argument, arg); line = any_one_arg(argument, arg);
/* Since all command triggers check for valid_dg_target before acting, the levelcheck /* Since all command triggers check for valid_dg_target before acting, the levelcheck
* here has been removed. * here has been removed. Otherwise, find the command. */
*/
/* otherwise, find the command */
{ {
int cont; /* continue the command checks */ int cont; /* continue the command checks */
cont = command_wtrigger(ch, arg, line); /* any world triggers ? */ 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)); ((*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) struct alias_data *find_alias(struct alias_data *alias_list, char *str)
{ {
while (alias_list != NULL) { while (alias_list != NULL) {
@ -676,7 +668,6 @@ struct alias_data *find_alias(struct alias_data *alias_list, char *str)
return (NULL); return (NULL);
} }
void free_alias(struct alias_data *a) void free_alias(struct alias_data *a)
{ {
if (a->alias) if (a->alias)
@ -686,7 +677,6 @@ void free_alias(struct alias_data *a)
free(a); free(a);
} }
/* The interface to the outside world: do_alias */ /* The interface to the outside world: do_alias */
ACMD(do_alias) ACMD(do_alias)
{ {
@ -736,18 +726,16 @@ ACMD(do_alias)
a->type = ALIAS_SIMPLE; a->type = ALIAS_SIMPLE;
a->next = GET_ALIASES(ch); a->next = GET_ALIASES(ch);
GET_ALIASES(ch) = a; GET_ALIASES(ch) = a;
// save_char(ch); save_char(ch);
send_to_char(ch, "Alias ready.\r\n"); send_to_char(ch, "Alias ready.\r\n");
} }
} }
} }
/* /* Valid numeric replacements are only $1 .. $9 (makes parsing a little easier,
* Valid numeric replacements are only $1 .. $9 (makes parsing a little * and it's not that much of a limitation anyway.) Also valid is "$*", which
* easier, and it's not that much of a limitation anyway.) Also valid * stands for the entire original line after the alias. ";" is used to delimit
* is "$*", which stands for the entire original line after the alias. * commands. */
* ";" is used to delimit commands.
*/
#define NUM_TOKENS 9 #define NUM_TOKENS 9
void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a) 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: * Return values:
* 0: String was modified in place; call command_interpreter immediately. * 0: String was modified in place; call command_interpreter immediately.
* 1: String was _not_ modified in place; rather, the expanded aliases * 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) int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen)
{ {
char first_arg[MAX_INPUT_LENGTH], *ptr; 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. */
/* 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.
* Various other parsing utilities * * 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 search_block(char *arg, const char **list, int exact)
{ {
int i, l; 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 * 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 * 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 '!', * 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 == '!') if (*arg == '!')
return (-1); return (-1);
@ -890,7 +867,6 @@ int search_block(char *arg, const char **list, int exact)
return (-1); return (-1);
} }
int is_number(const char *str) int is_number(const char *str)
{ {
while (*str) while (*str)
@ -900,26 +876,21 @@ int is_number(const char *str)
return (1); 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) void skip_spaces(char **string)
{ {
for (; **string && isspace(**string); (*string)++); for (; **string && isspace(**string); (*string)++);
} }
/* /* Given a string, change all instances of double dollar signs ($$) to single
* Given a string, change all instances of double dollar signs ($$) to * dollar signs ($). When strings come in, all $'s are changed to $$'s to
* single dollar signs ($). When strings come in, all $'s are changed * avoid having users be able to crash the system if the inputted string is
* to $$'s to avoid having users be able to crash the system if the * eventually sent to act(). If you are using user input to produce screen
* inputted string is eventually sent to act(). If you are using user * output AND YOU ARE SURE IT WILL NOT BE SENT THROUGH THE act() FUNCTION
* input to produce screen output AND YOU ARE SURE IT WILL NOT BE SENT * (i.e., do_gecho, do_title, but NOT do_say), you can call
* THROUGH THE act() FUNCTION (i.e., do_gecho, do_title, but NOT do_say), * delete_doubledollar() to make the output look correct.
* you can call delete_doubledollar() to make the output look correct. * Modifies the string in-place. */
*
* Modifies the string in-place.
*/
char *delete_doubledollar(char *string) char *delete_doubledollar(char *string)
{ {
char *ddread, *ddwrite; char *ddread, *ddwrite;
@ -942,23 +913,18 @@ char *delete_doubledollar(char *string)
return (string); return (string);
} }
int fill_word(char *argument) int fill_word(char *argument)
{ {
return (search_block(argument, fill, TRUE) >= 0); return (search_block(argument, fill, TRUE) >= 0);
} }
int reserved_word(char *argument) 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. */
* 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 *one_argument(char *argument, char *first_arg)
{ {
char *begin = first_arg; char *begin = first_arg;
@ -984,13 +950,8 @@ char *one_argument(char *argument, char *first_arg)
return (argument); 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) char *one_word(char *argument, char *first_arg)
{ {
skip_spaces(&argument); skip_spaces(&argument);
@ -1013,7 +974,6 @@ char *one_word(char *argument, char *first_arg)
return (argument); return (argument);
} }
/* same as one_argument except that it doesn't ignore fill words */ /* same as one_argument except that it doesn't ignore fill words */
char *any_one_arg(char *argument, char *first_arg) char *any_one_arg(char *argument, char *first_arg)
{ {
@ -1029,26 +989,15 @@ char *any_one_arg(char *argument, char *first_arg)
return (argument); 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) 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. */
/*
* 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
*/
int is_abbrev(const char *arg1, const char *arg2) int is_abbrev(const char *arg1, const char *arg2)
{ {
if (!*arg1) if (!*arg1)
@ -1064,13 +1013,8 @@ int is_abbrev(const char *arg1, const char *arg2)
return (0); 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) void half_chop(char *string, char *arg1, char *arg2)
{ {
char *temp; char *temp;
@ -1080,8 +1024,6 @@ void half_chop(char *string, char *arg1, char *arg2)
strcpy(arg2, temp); /* strcpy: OK (documentation) */ strcpy(arg2, temp); /* strcpy: OK (documentation) */
} }
/* Used in specprocs, mostly. (Exactly) matches "command" to cmd number */ /* Used in specprocs, mostly. (Exactly) matches "command" to cmd number */
int find_command(const char *command) int find_command(const char *command)
{ {
@ -1094,7 +1036,6 @@ int find_command(const char *command)
return (-1); return (-1);
} }
int special(struct char_data *ch, int cmd, char *arg) int special(struct char_data *ch, int cmd, char *arg)
{ {
struct obj_data *i; struct obj_data *i;
@ -1133,13 +1074,7 @@ int special(struct char_data *ch, int cmd, char *arg)
return (0); 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. */ /* This function needs to die. */
int _parse_name(char *arg, char *name) int _parse_name(char *arg, char *name)
{ {
@ -1156,7 +1091,6 @@ int _parse_name(char *arg, char *name)
return (0); return (0);
} }
#define RECON 1 #define RECON 1
#define USURP 2 #define USURP 2
#define UNSWITCH 3 #define UNSWITCH 3
@ -1170,10 +1104,8 @@ int perform_dupe_check(struct descriptor_data *d)
int pref_temp = 0; /* for "last" log */ int pref_temp = 0; /* for "last" log */
int id = GET_IDNUM(d->character); int id = GET_IDNUM(d->character);
/* /* Now that this descriptor has successfully logged in, disconnect all
* Now that this descriptor has successfully logged in, disconnect all * other descriptors controlling a character with the same ID number. */
* other descriptors controlling a character with the same ID number.
*/
for (k = descriptor_list; k; k = next_k) { for (k = descriptor_list; k; k = next_k) {
next_k = k->next; 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
* now, go through the character list, deleting all characters that * already marked for deletion from the above step (i.e., in the CON_HANGUP
* are not already marked for deletion from the above step (i.e., in the * state), and have not already been selected as a target for switching into.
* CON_HANGUP state), and have not already been selected as a target for * In addition, if we haven't already found a target, choose one if one is
* switching into. In addition, if we haven't already found a target, * available (while still deleting the other duplicates, though theoretically
* choose one if one is available (while still deleting the other * none should be able to exist). */
* duplicates, though theoretically none should be able to exist).
*/
for (ch = character_list; ch; ch = next_ch) { for (ch = character_list; ch; ch = next_ch) {
next_ch = ch->next; next_ch = ch->next;
@ -1310,24 +1239,20 @@ int enter_player_game (struct descriptor_data *d)
room_vnum load_room; room_vnum load_room;
reset_char(d->character); reset_char(d->character);
/* /* See if there might be some aliases in the old alias file. Only do this
* See if there might be some aliases in the old alias file. * if there were no aliases in the pfile. */
* Only do this if there were no aliases in the pfile.
*/
if (GET_ALIASES(d->character) == NULL) if (GET_ALIASES(d->character) == NULL)
{ {
read_aliases(d->character); 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)); delete_aliases(GET_NAME(d->character));
} }
if (PLR_FLAGGED(d->character, PLR_INVSTART)) if (PLR_FLAGGED(d->character, PLR_INVSTART))
GET_INVIS_LEV(d->character) = GET_LEVEL(d->character); GET_INVIS_LEV(d->character) = GET_LEVEL(d->character);
/* /* We have to place the character in a room before equipping them
* We have to place the character in a room before equipping them * or equip_char() will gripe about the person in NOWHERE. */
* or equip_char() will gripe about the person in NOWHERE.
*/
if ((load_room = GET_LOADROOM(d->character)) != NOWHERE) if ((load_room = GET_LOADROOM(d->character)) != NOWHERE)
load_room = real_room(load_room); load_room = real_room(load_room);
@ -1347,9 +1272,9 @@ int enter_player_game (struct descriptor_data *d)
/* find_char helper */ /* find_char helper */
add_to_lookup_table(GET_ID(d->character), (void *)d->character); 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 /* After moving saving of variables to the player file, this should only
// in case nothing was found in the pfile. If something was found, SCRIPT(ch) will * be called in case nothing was found in the pfile. If something was
// be set * found, SCRIPT(ch) will be set. */
if (!SCRIPT(d->character)) if (!SCRIPT(d->character))
read_saved_vars(d->character); read_saved_vars(d->character);
@ -1362,7 +1287,6 @@ int enter_player_game (struct descriptor_data *d)
return load_result; return load_result;
} }
/* deal with newcomers and other non-playing sockets */ /* deal with newcomers and other non-playing sockets */
void nanny(struct descriptor_data *d, char *arg) void nanny(struct descriptor_data *d, char *arg)
{ {
@ -1388,9 +1312,7 @@ void nanny(struct descriptor_data *d, char *arg)
skip_spaces(&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++) for (player_i = 0; olc_functions[player_i].state >= 0; player_i++)
if (STATE(d) == olc_functions[player_i].state) { if (STATE(d) == olc_functions[player_i].state) {
/* send context-sensitive help if need be */ /* send context-sensitive help if need be */
@ -1505,15 +1427,13 @@ void nanny(struct descriptor_data *d, char *arg)
break; break;
case CON_PASSWORD: /* get pwd for known player */ case CON_PASSWORD: /* get pwd for known player */
/* /* To really prevent duping correctly, the player's record should be reloaded
* To really prevent duping correctly, the player's record should * from disk at this point (after the password has been typed). However I'm
* be reloaded from disk at this point (after the password has been * afraid that trying to load a character over an already loaded character is
* typed). However I'm afraid that trying to load a character over * going to cause some problem down the road that I can't see at the moment.
* an already loaded character is going to cause some problem down the * So to compensate, I'm going to (1) add a 15 or 20-second time limit for
* road that I can't see at the moment. So to compensate, I'm going to * entering a password, and (2) re-add the code to cut off duplicates when a
* (1) add a 15 or 20-second time limit for entering a password, and (2) * player quits. JE 6 Feb 96 */
* re-add the code to cut off duplicates when a player quits. JE 6 Feb 96
*/
echo_on(d); /* turn echo back on */ echo_on(d); /* turn echo back on */
@ -1716,14 +1636,8 @@ void nanny(struct descriptor_data *d, char *arg)
case '2': case '2':
if (d->character->player.description) { if (d->character->player.description) {
write_to_output(d, "Current description:\r\n%s", 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
* Don't free this now... so that the old description gets loaded * current buffer in the editor. Do setup the ABORT buffer here, however. */
* as the current buffer in the editor. Do setup the ABORT buffer
* here, however.
*
* free(d->character->player.description);
* d->character->player.description = NULL;
*/
d->backstr = strdup(d->character->player.description); 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"); 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; break;
/* /* It is possible, if enough pulses are missed, to kick someone off while
* It's possible, if enough pulses are missed, to kick someone off * they are at the password prompt. We'll just defer to let the game_loop()
* while they are at the password prompt. We'll just defer to let * axe them. */
* the game_loop() axe them.
*/
case CON_CLOSE: case CON_CLOSE:
break; break;

View file

@ -481,7 +481,7 @@
/* ** MAX_PWD_LENGTH changed from 10 to 30 for ascii test - Sam ** */ /* ** MAX_PWD_LENGTH changed from 10 to 30 for ascii test - Sam ** */
#define MAX_PWD_LENGTH 30 #define MAX_PWD_LENGTH 30
#define MAX_TITLE_LENGTH 80 #define MAX_TITLE_LENGTH 80
#define HOST_LENGTH 30 #define HOST_LENGTH 40
#define PLR_DESC_LENGTH 512 #define PLR_DESC_LENGTH 512
#define MAX_TONGUE 3 #define MAX_TONGUE 3
#define MAX_SKILLS 200 #define MAX_SKILLS 200