Removed dead stores.

This commit is contained in:
wyld-sw 2018-07-15 10:29:57 -04:00
parent 5cca63a01c
commit bf941bc9b2
28 changed files with 85 additions and 139 deletions

View file

@ -72,7 +72,6 @@ static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mod
if ((mode == 0) && obj->description) {
if (GET_OBJ_VAL(obj, 1) != 0 || OBJ_SAT_IN_BY(obj)) {
temp = OBJ_SAT_IN_BY(obj);
for (temp = OBJ_SAT_IN_BY(obj); temp; temp = NEXT_SITTING(temp)) {
if (temp == ch)
found++;
@ -2543,8 +2542,7 @@ ACMD(do_areas)
len += tmp_len;
if (overlap_shown) {
tmp_len = snprintf(buf+len, sizeof(buf)-len, "Areas shown in \trred\tn may have some creatures outside the specified range.\r\n");
len += tmp_len;
snprintf(buf+len, sizeof(buf)-len, "Areas shown in \trred\tn may have some creatures outside the specified range.\r\n");
}
if (zcount == 0)

View file

@ -770,8 +770,6 @@ ACMD(do_sit)
one_argument(argument, arg);
if (!*arg)
found = 0;
if (!(furniture = get_obj_in_list_vis(ch, arg, NULL, world[ch->in_room].contents)))
found = 0;
else

View file

@ -1877,7 +1877,7 @@ struct last_entry *find_llog_entry(int punique, long idnum) {
static void mod_llog_entry(struct last_entry *llast,int type) {
FILE *fp;
struct last_entry mlast;
int size, recs, tmp, i, j;
int size, recs, tmp;
if(!(fp=fopen(LAST_FILE,"r+"))) {
log("Error opening last_file for reading and writing.");
@ -1893,7 +1893,7 @@ static void mod_llog_entry(struct last_entry *llast,int type) {
* do (like searching for the last shutdown/etc..) */
for(tmp=recs; tmp > 0; tmp--) {
fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR);
i = fread(&mlast,sizeof(struct last_entry),1,fp);
fread(&mlast,sizeof(struct last_entry),1,fp);
/* Another one to keep that stepback. */
fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR);
@ -1908,7 +1908,7 @@ static void mod_llog_entry(struct last_entry *llast,int type) {
}
mlast.close_time=time(0);
/*write it, and we're done!*/
j = fwrite(&mlast,sizeof(struct last_entry),1,fp);
fwrite(&mlast,sizeof(struct last_entry),1,fp);
fclose(fp);
return;
}
@ -1923,7 +1923,6 @@ static void mod_llog_entry(struct last_entry *llast,int type) {
void add_llog_entry(struct char_data *ch, int type) {
FILE *fp;
struct last_entry *llast;
int i;
/* so if a char enteres a name, but bad password, otherwise loses link before
* he gets a pref assinged, we won't record it */
@ -1950,7 +1949,7 @@ void add_llog_entry(struct char_data *ch, int type) {
free(llast);
return;
}
i = fwrite(llast,sizeof(struct last_entry),1,fp);
fwrite(llast,sizeof(struct last_entry),1,fp);
fclose(fp);
} else {
/* We've found a login - update it */
@ -1962,7 +1961,7 @@ void add_llog_entry(struct char_data *ch, int type) {
void clean_llog_entries(void) {
FILE *ofp, *nfp;
struct last_entry mlast;
int recs, i, j;
int recs;
if(!(ofp=fopen(LAST_FILE,"r")))
return; /* no file, no gripe */
@ -1987,8 +1986,8 @@ void clean_llog_entries(void) {
/* copy the rest */
while (!feof(ofp)) {
i = fread(&mlast,sizeof(struct last_entry),1,ofp);
j = fwrite(&mlast,sizeof(struct last_entry),1,nfp);
fread(&mlast,sizeof(struct last_entry),1,ofp);
fwrite(&mlast,sizeof(struct last_entry),1,nfp);
}
fclose(ofp);
fclose(nfp);
@ -2002,7 +2001,6 @@ static void list_llog_entries(struct char_data *ch)
{
FILE *fp;
struct last_entry llast;
int i;
char timestr[25];
if(!(fp=fopen(LAST_FILE,"r"))) {
@ -2010,14 +2008,14 @@ static void list_llog_entries(struct char_data *ch)
send_to_char(ch, "Error! - no last log");
}
send_to_char(ch, "Last log\r\n");
i = fread(&llast, sizeof(struct last_entry), 1, fp);
fread(&llast, sizeof(struct last_entry), 1, fp);
strftime(timestr, sizeof(timestr), "%a %b %d %Y %H:%M:%S", localtime(&llast.time));
while(!feof(fp)) {
send_to_char(ch, "%10s\t%d\t%s\t%s\r\n", llast.username, llast.punique,
last_array[llast.close_type], timestr);
i = fread(&llast, sizeof(struct last_entry), 1, fp);
fread(&llast, sizeof(struct last_entry), 1, fp);
}
}
@ -2039,7 +2037,7 @@ ACMD(do_last)
time_t delta;
struct char_data *vict = NULL;
struct char_data *temp;
int recs, i, num = 0;
int recs, num = 0;
FILE *fp;
struct last_entry mlast;
@ -2097,7 +2095,7 @@ ACMD(do_last)
send_to_char(ch, "Last log\r\n");
while(num > 0 && recs > 0) {
fseek(fp,-1* ((long)sizeof(struct last_entry)),SEEK_CUR);
i = fread(&mlast,sizeof(struct last_entry),1,fp);
fread(&mlast,sizeof(struct last_entry),1,fp);
fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR);
if(!*name ||(*name && !str_cmp(name, mlast.username))) {
strftime(timestr, sizeof(timestr), "%a %b %d %Y %H:%M", localtime(&mlast.time));
@ -2180,7 +2178,6 @@ ACMD(do_wiznet)
buf2[MAX_INPUT_LENGTH + MAX_NAME_LENGTH + 32];
struct descriptor_data *d;
char emote = FALSE;
char any = FALSE;
int level = LVL_IMMORT;
skip_spaces(&argument);
@ -2207,7 +2204,7 @@ ACMD(do_wiznet)
case '@':
send_to_char(ch, "God channel status:\r\n");
for (any = 0, d = descriptor_list; d; d = d->next) {
for (d = descriptor_list; d; d = d->next) {
if (STATE(d) != CON_PLAYING || GET_LEVEL(d->character) < LVL_IMMORT)
continue;
if (!CAN_SEE(ch, d->character))
@ -2422,7 +2419,7 @@ static size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int l
zone_table[zone].age, zone_table[zone].lifespan,
zone_table[zone].reset_mode ? ((zone_table[zone].reset_mode == 1) ? "Reset when no players are in zone" : "Normal reset") : "Never reset",
zone_table[zone].bot, zone_table[zone].top);
i = j = k = l = m = n = o = 0;
j = k = l = m = n = o = 0;
for (i = 0; i < top_of_world; i++)
if (world[i].number >= zone_table[zone].bot && world[i].number <= zone_table[zone].top)
@ -3666,7 +3663,7 @@ ACMD (do_zcheck)
"- Neither SENTINEL nor STAY_ZONE bits set.\r\n");
if (MOB_FLAGGED(mob, MOB_SPEC) && (found = 1))
len += snprintf(buf + len, sizeof(buf) - len,
snprintf(buf + len, sizeof(buf) - len,
"- SPEC flag needs to be removed.\r\n");
/* Additional mob checks.*/
@ -3804,7 +3801,7 @@ ACMD (do_zcheck)
ext2 = ext;
if (ext2 && (found = 1))
len += snprintf(buf + len, sizeof(buf) - len,
snprintf(buf + len, sizeof(buf) - len,
"- has unformatted extra description\r\n");
/* Additional object checks. */
if (found) {
@ -4153,7 +4150,6 @@ ACMD(do_copyover)
FILE *fp;
struct descriptor_data *d, *d_next;
char buf [100], buf2[100];
int i;
fp = fopen (COPYOVER_FILE, "w");
if (!fp) {
@ -4199,7 +4195,7 @@ ACMD(do_copyover)
sprintf (buf2, "-C%d", mother_desc);
/* Ugh, seems it is expected we are 1 step above lib - this may be dangerous! */
i = chdir ("..");
chdir ("..");
/* Close reserve and other always-open files and release other resources */
execl (EXE_FILE, "circle", buf2, buf, (char *) NULL);
@ -4229,17 +4225,15 @@ ACMD(do_peace)
ACMD(do_zpurge)
{
int vroom, room, vzone = 0, zone = 0;
int vroom, room, zone = 0;
char arg[MAX_INPUT_LENGTH];
int purge_all = FALSE;
one_argument(argument, arg);
if (*arg == '.' || !*arg) {
zone = world[IN_ROOM(ch)].zone;
vzone = zone_table[zone].number;
}
else if (is_number(arg)) {
vzone = atoi(arg);
zone = real_zone(vzone);
zone = real_zone(atoi(arg));
if (zone == NOWHERE || zone > top_of_zone_table) {
send_to_char(ch, "That zone doesn't exist!\r\n");
return;
@ -4291,7 +4285,7 @@ ACMD(do_file)
int req_file_lines = 0; /* Number of total lines in file to be read. */
int lines_read = 0; /* Counts total number of lines read from the file. */
int req_lines = 0; /* Number of lines requested to be displayed. */
int i, j; /* Generic loop counters. */
int i; /* Generic loop counter. */
int l; /* Marks choice of file in fields array. */
char field[MAX_INPUT_LENGTH]; /* Holds users choice of file to be read. */
char value[MAX_INPUT_LENGTH]; /* Holds # lines to be read, if requested. */
@ -4335,7 +4329,7 @@ ACMD(do_file)
/* Display usage if no argument. */
if (!*argument) {
send_to_char(ch, "USAGE: file <filename> <num lines>\r\n\r\nFile options:\r\n");
for (j = 0, i = 0; fields[i].level; i++)
for (i = 0; fields[i].level; i++)
if (fields[i].level <= GET_LEVEL(ch))
send_to_char(ch, "%-15s%s\r\n", fields[i].cmd, fields[i].file);
return;

View file

@ -185,7 +185,7 @@ static void aedit_save_internally(struct descriptor_data *d) {
}
/* pass the editted action back to the list - no need to add */
else {
i = aedit_find_command(OLC_ACTION(d)->command);
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));

View file

@ -516,7 +516,7 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
count += sprintf(buf + count, "\tn%s Swim\\\\", map_info[SECT_WATER_SWIM].disp);
count += sprintf(buf + count, "\tn%s Boat\\\\", map_info[SECT_WATER_NOSWIM].disp);
count += sprintf(buf + count, "\tn%s Flying\\\\", map_info[SECT_FLYING].disp);
count += sprintf(buf + count, "\tn%s Underwater\\\\", map_info[SECT_UNDERWATER].disp);
sprintf(buf + count, "\tn%s Underwater\\\\", map_info[SECT_UNDERWATER].disp);
strcpy(buf, strfrmt(buf, LEGEND_WIDTH, CANVAS_HEIGHT + 2, FALSE, TRUE, TRUE));

View file

@ -409,7 +409,7 @@ int board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj
void board_save_board(int board_type)
{
FILE *fl;
int i, j;
int i;
char *tmp1, *tmp2 = NULL;
if (!num_of_msgs[board_type]) {
@ -420,7 +420,7 @@ void board_save_board(int board_type)
perror("SYSERR: Error writing board");
return;
}
j = fwrite(&(num_of_msgs[board_type]), sizeof(int), 1, fl);
fwrite(&(num_of_msgs[board_type]), sizeof(int), 1, fl);
for (i = 0; i < num_of_msgs[board_type]; i++) {
if ((tmp1 = MSG_HEADING(board_type, i)) != NULL)
@ -435,11 +435,11 @@ void board_save_board(int board_type)
else
msg_index[board_type][i].message_len = strlen(tmp2) + 1;
j = fwrite(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl);
fwrite(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl);
if (tmp1)
j = fwrite(tmp1, sizeof(char), msg_index[board_type][i].heading_len, fl);
fwrite(tmp1, sizeof(char), msg_index[board_type][i].heading_len, fl);
if (tmp2)
j = fwrite(tmp2, sizeof(char), msg_index[board_type][i].message_len, fl);
fwrite(tmp2, sizeof(char), msg_index[board_type][i].message_len, fl);
}
fclose(fl);
@ -448,7 +448,7 @@ void board_save_board(int board_type)
void board_load_board(int board_type)
{
FILE *fl;
int i, j, len1, len2;
int i, len1, len2;
char *tmp1, *tmp2;
if (!(fl = fopen(FILENAME(board_type), "rb"))) {
@ -464,14 +464,14 @@ void board_load_board(int board_type)
return;
}
for (i = 0; i < num_of_msgs[board_type]; i++) {
j = fread(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl);
fread(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl);
if ((len1 = msg_index[board_type][i].heading_len) <= 0) {
log("SYSERR: Board file %d corrupt! Resetting.", board_type);
board_reset_board(board_type);
return;
}
CREATE(tmp1, char, len1);
j = fread(tmp1, sizeof(char), len1, fl);
fread(tmp1, sizeof(char), len1, fl);
MSG_HEADING(board_type, i) = tmp1;
if ((MSG_SLOTNUM(board_type, i) = find_slot()) == -1) {
@ -481,7 +481,7 @@ void board_load_board(int board_type)
}
if ((len2 = msg_index[board_type][i].message_len) > 0) {
CREATE(tmp2, char, len2);
j = fread(tmp2, sizeof(char), len2, fl);
fread(tmp2, sizeof(char), len2, fl);
msg_storage[MSG_SLOTNUM(board_type, i)] = tmp2;
} else
msg_storage[MSG_SLOTNUM(board_type, i)] = NULL;

View file

@ -422,7 +422,7 @@ void copyover_recover()
for (;;) {
fOld = TRUE;
i = fscanf (fp, "%d %ld %s %s %s\n", &desc, &pref, name, host, guiopt);
fscanf (fp, "%d %ld %s %s %s\n", &desc, &pref, name, host, guiopt);
if (desc == -1)
break;

View file

@ -155,10 +155,9 @@ static int hsort(const void *a, const void *b);
char *fread_action(FILE *fl, int nr)
{
char buf[MAX_STRING_LENGTH];
char *buf1;
int i;
buf1 = fgets(buf, MAX_STRING_LENGTH, fl);
fgets(buf, MAX_STRING_LENGTH, fl);
if (feof(fl)) {
log("SYSERR: fread_action: unexpected EOF near action #%d", nr);
/* SYSERR_DESC: fread_action() will fail if it discovers an end of file
@ -186,8 +185,8 @@ char *fread_action(FILE *fl, int nr)
static void boot_social_messages(void)
{
FILE *fl;
int nr = 0, hide, min_char_pos, min_pos, min_lvl, curr_soc = -1, i;
char next_soc[MAX_STRING_LENGTH], sorted[MAX_INPUT_LENGTH], *buf;
int nr = 0, hide, min_char_pos, min_pos, min_lvl, curr_soc = -1;
char next_soc[MAX_STRING_LENGTH], sorted[MAX_INPUT_LENGTH];
if (CONFIG_NEW_SOCIALS == TRUE) {
/* open social file */
@ -201,7 +200,7 @@ static void boot_social_messages(void)
/* count socials */
*next_soc = '\0';
while (!feof(fl)) {
buf = fgets(next_soc, MAX_STRING_LENGTH, fl);
fgets(next_soc, MAX_STRING_LENGTH, fl);
if (*next_soc == '~') top_of_socialt++;
}
} else { /* old style */
@ -216,7 +215,7 @@ static void boot_social_messages(void)
}
/* count socials */
while (!feof(fl)) {
buf = fgets(next_soc, MAX_STRING_LENGTH, fl);
fgets(next_soc, MAX_STRING_LENGTH, fl);
if (*next_soc == '\n' || *next_soc == '\r') top_of_socialt++; /* all socials are followed by a blank line */
}
}
@ -228,7 +227,7 @@ static void boot_social_messages(void)
/* now read 'em */
for (;;) {
i = fscanf(fl, " %s ", next_soc);
fscanf(fl, " %s ", next_soc);
if (*next_soc == '$') break;
if (CONFIG_NEW_SOCIALS == TRUE) {
if (fscanf(fl, " %s %d %d %d %d \n",
@ -795,12 +794,11 @@ static void reset_time(void)
{
time_t beginning_of_time = 0;
FILE *bgtime;
int i;
if ((bgtime = fopen(TIME_FILE, "r")) == NULL)
log("No time file '%s' starting from the beginning.", TIME_FILE);
else {
i = fscanf(bgtime, "%ld\n", (long *)&beginning_of_time);
fscanf(bgtime, "%ld\n", (long *)&beginning_of_time);
fclose(bgtime);
}
@ -913,7 +911,7 @@ void index_boot(int mode)
{
const char *index_filename, *prefix = NULL; /* NULL or egcs 1.1 complains */
FILE *db_index, *db_file;
int rec_count = 0, size[2], i;
int rec_count = 0, size[2];
char buf2[PATH_MAX], buf1[MAX_STRING_LENGTH];
switch (mode) {
@ -958,13 +956,13 @@ void index_boot(int mode)
}
/* first, count the number of records in the file so we can malloc */
i = fscanf(db_index, "%s\n", buf1);
fscanf(db_index, "%s\n", buf1);
while (*buf1 != '$') {
snprintf(buf2, sizeof(buf2), "%s%s", prefix, buf1);
if (!(db_file = fopen(buf2, "r"))) {
log("SYSERR: File '%s' listed in '%s/%s': %s", buf2, prefix,
index_filename, strerror(errno));
i = fscanf(db_index, "%s\n", buf1);
fscanf(db_index, "%s\n", buf1);
continue;
} else {
if (mode == DB_BOOT_ZON)
@ -976,7 +974,7 @@ void index_boot(int mode)
}
fclose(db_file);
i = fscanf(db_index, "%s\n", buf1);
fscanf(db_index, "%s\n", buf1);
}
/* Exit if 0 records, unless this is shops */
@ -1030,7 +1028,7 @@ void index_boot(int mode)
}
rewind(db_index);
i = fscanf(db_index, "%s\n", buf1);
fscanf(db_index, "%s\n", buf1);
while (*buf1 != '$') {
snprintf(buf2, sizeof(buf2), "%s%s", prefix, buf1);
if (!(db_file = fopen(buf2, "r"))) {
@ -1057,7 +1055,7 @@ void index_boot(int mode)
}
fclose(db_file);
i = fscanf(db_index, "%s\n", buf1);
fscanf(db_index, "%s\n", buf1);
}
fclose(db_index);

View file

@ -92,9 +92,7 @@ void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, cha
one_argument(strcpy(buf2, t), t);
skip_spaces(&t);
}
if (IS_SET(SINFO.targets, TAR_IGNORE)) {
target = TRUE;
} else if (t != NULL && *t) {
if (!IS_SET(SINFO.targets, TAR_IGNORE) && t != NULL && *t) {
if (!target &&
(IS_SET(SINFO.targets, TAR_CHAR_ROOM) ||
IS_SET(SINFO.targets, TAR_CHAR_WORLD))) {

View file

@ -592,7 +592,7 @@ ACMD(do_mteleport)
if (AFF_FLAGGED(ch, AFF_CHARM))
return;
argument = two_arguments(argument, arg1, arg2);
two_arguments(argument, arg1, arg2);
if (!*arg1 || !*arg2) {
mob_log(ch, "mteleport: bad syntax");

View file

@ -794,7 +794,7 @@ static void do_stat_trigger(struct char_data *ch, trig_data *trig)
len += snprintf(sb + len, sizeof(sb)-len, "%s\r\n", cmd_list->cmd);
if (len>MAX_STRING_LENGTH-80) {
len += snprintf(sb + len, sizeof(sb)-len, "*** Overflow - script too long! ***\r\n");
snprintf(sb + len, sizeof(sb)-len, "*** Overflow - script too long! ***\r\n");
break;
}
@ -1516,7 +1516,7 @@ static void eval_expr(char *line, char *result, void *go, struct script_data *sc
if (eval_lhs_op_rhs(line, result, go, sc, trig, type));
else if (*line == '(') {
p = strcpy(expr, line);
strcpy(expr, line);
p = matching_paren(expr);
*p = '\0';
eval_expr(expr + 1, result, go, sc, trig, type);
@ -2179,12 +2179,12 @@ ACMD(do_vdelete)
struct script_data *sc_remote=NULL;
char *var, *uid_p;
char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH];
long uid, context;
long uid;
room_data *room;
char_data *mob;
obj_data *obj;
argument = two_arguments(argument, buf, buf2);
two_arguments(argument, buf, buf2);
var = buf;
uid_p = buf2;
skip_spaces(&var);
@ -2207,7 +2207,6 @@ ACMD(do_vdelete)
sc_remote = SCRIPT(room);
} else if ((mob = find_char(uid))) {
sc_remote = SCRIPT(mob);
if (!IS_NPC(mob)) context = 0;
} else if ((obj = find_obj(uid))) {
sc_remote = SCRIPT(obj);
} else {
@ -2287,7 +2286,7 @@ static void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd)
struct script_data *sc_remote=NULL;
char *line, *var, *uid_p;
char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
long uid, context;
long uid;
room_data *room;
char_data *mob;
obj_data *obj;
@ -2317,7 +2316,6 @@ static void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd)
sc_remote = SCRIPT(room);
} else if ((mob = find_char(uid))) {
sc_remote = SCRIPT(mob);
if (!IS_NPC(mob)) context = 0;
} else if ((obj = find_obj(uid))) {
sc_remote = SCRIPT(obj);
} else {

View file

@ -727,7 +727,6 @@ void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to)
obj->next_content = obj_to->contains;
obj_to->contains = obj;
obj->in_obj = obj_to;
tmp_obj = obj->in_obj;
/* Add weight to container, unless unlimited. */
if (GET_OBJ_VAL(obj->in_obj, 0) > 0) {
@ -751,7 +750,6 @@ void obj_from_obj(struct obj_data *obj)
return;
}
obj_from = obj->in_obj;
temp = obj->in_obj;
REMOVE_FROM_LIST(obj, obj_from->contains, next_content);
/* Subtract weight from containers container unless unlimited. */

View file

@ -385,7 +385,7 @@ ACMD(do_helpcheck)
}
}
if (count % 3 && len < sizeof(buf))
nlen = snprintf(buf + len, sizeof(buf) - len, "\r\n");
snprintf(buf + len, sizeof(buf) - len, "\r\n");
if (ch->desc) {
if (len == 0)
@ -431,12 +431,12 @@ ACMD(do_hindex)
if (!count)
len += snprintf(buf + len, sizeof(buf) - len, " None.\r\n");
if (!count2)
len2 += snprintf(buf2 + len2, sizeof(buf2) - len2, " None.\r\n");
snprintf(buf2 + len2, sizeof(buf2) - len2, " None.\r\n");
// Join the two strings
len += snprintf(buf + len, sizeof(buf) - len, "%s", buf2);
len += snprintf(buf + len, sizeof(buf) - len, "\t1Applicable Index Entries: \t3%d\r\n"
snprintf(buf + len, sizeof(buf) - len, "\t1Applicable Index Entries: \t3%d\r\n"
"\t1Total Index Entries: \t3%d\tn\r\n", count + count2, top_of_helpt);
page_string(ch->desc, buf, TRUE);

View file

@ -287,22 +287,19 @@ void load_ibt_file(int mode)
void save_ibt_file(int mode)
{
IBT_DATA *ibtData, *first_ibt, *last_ibt;
IBT_DATA *ibtData, *first_ibt;
FILE *fp;
char filename[256];
switch(mode) {
case SCMD_BUG : sprintf( filename, "%s",BUGS_FILE );
first_ibt = first_bug;
last_ibt = last_bug;
break;
case SCMD_IDEA: sprintf( filename, "%s",IDEAS_FILE );
first_ibt = first_idea;
last_ibt = last_idea;
break;
case SCMD_TYPO: sprintf( filename, "%s",TYPOS_FILE );
first_ibt = first_typo;
last_ibt = last_typo;
break;
default : log("SYSERR: Invalid mode (%d) in save_ibt_file", mode);
return;
@ -457,17 +454,16 @@ ACMD(do_ibt)
char buf[MAX_STRING_LENGTH], *arg_text, imp[30], timestr[128];
int i, num_res, num_unres;
size_t len = 0;
IBT_DATA *ibtData, *first_ibt, *last_ibt;
IBT_DATA *ibtData, *first_ibt;
int ano=0;
if (IS_NPC(ch))
return;
arg_text = one_argument(argument, arg);
argument = two_arguments(argument, arg, arg2);
two_arguments(argument, arg, arg2);
first_ibt = get_first_ibt(subcmd);
last_ibt = get_last_ibt(subcmd);
if ((!*arg)){
if (GET_LEVEL(ch) >= LVL_GRGOD){
@ -633,9 +629,9 @@ ACMD(do_ibt)
if (GET_LEVEL(ch) >= LVL_GRGOD) {
len += snprintf(buf + len, sizeof(buf) - len, "%sYou may use %s remove, resolve or edit to change the list..%s\r\n", QCYN, CMD_NAME, QNRM);
}
len += snprintf(buf + len, sizeof(buf) - len, "%sYou may use %s%s show <number>%s to see more indepth about the %s.%s\r\n", QCYN, QYEL, CMD_NAME, QCYN, CMD_NAME, QNRM);
snprintf(buf + len, sizeof(buf) - len, "%sYou may use %s%s show <number>%s to see more indepth about the %s.%s\r\n", QCYN, QYEL, CMD_NAME, QCYN, CMD_NAME, QNRM);
} else {
len += snprintf(buf + len, sizeof(buf) - len, "No %ss have been reported!\r\n", CMD_NAME);
snprintf(buf + len, sizeof(buf) - len, "No %ss have been reported!\r\n", CMD_NAME);
}
page_string(ch->desc, buf, TRUE);
@ -775,14 +771,14 @@ ACMD(do_oasis_ibtedit)
{
int number = NOTHING;
struct descriptor_data *d;
char buf1[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH], *buf3;
char buf1[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
/* No editing as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
return;
/* Parse any arguments */
buf3 = two_arguments(argument, buf1, buf2);
two_arguments(argument, buf1, buf2);
if (!*buf1) {
send_to_char(ch, "Specify a %s number to edit.\r\n", ibt_types[subcmd]);

View file

@ -1306,7 +1306,7 @@ EVENTFUNC(get_protocols)
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");
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toATCP\tO] \tw%s\tn\r\n\r\n", d->pProtocol->bATCP ? "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);

View file

@ -198,7 +198,6 @@ void run_autowiz(void)
if (CONFIG_USE_AUTOWIZ) {
size_t res;
char buf[256];
int i;
#if defined(CIRCLE_UNIX)
res = snprintf(buf, sizeof(buf), "nice ../bin/autowiz %d %s %d %s %d &",
@ -212,7 +211,7 @@ void run_autowiz(void)
if (res < sizeof(buf)) {
mudlog(CMP, LVL_IMMORT, FALSE, "Initiating autowiz.");
reboot_wizlists();
i = system(buf);
system(buf);
} else
log("Cannot run autowiz: command-line doesn't fit in buffer.");
}

View file

@ -45,7 +45,6 @@ ACMD(do_oasis_medit)
{
int number = NOBODY, save = 0, real_num;
struct descriptor_data *d;
char *buf3;
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
@ -54,7 +53,7 @@ ACMD(do_oasis_medit)
return;
/* Parse any arguments */
buf3 = two_arguments(argument, buf1, buf2);
two_arguments(argument, buf1, buf2);
if (!*buf1) {
send_to_char(ch, "Specify a mobile VNUM to edit.\r\n");

View file

@ -75,7 +75,7 @@ void load_messages(void)
FILE *fl;
int i, type;
struct message_type *messages;
char chk[128], *buf;
char chk[128];
if (!(fl = fopen(MESS_FILE, "r"))) {
log("SYSERR: Error reading combat message file %s: %s", MESS_FILE, strerror(errno));
@ -89,12 +89,12 @@ void load_messages(void)
}
while (!feof(fl)) {
buf = fgets(chk, 128, fl);
fgets(chk, 128, fl);
while (!feof(fl) && (*chk == '\n' || *chk == '*'))
buf = fgets(chk, 128, fl);
fgets(chk, 128, fl);
while (*chk == 'M') {
buf = fgets(chk, 128, fl);
fgets(chk, 128, fl);
sscanf(chk, " %d\n", &type);
for (i = 0; (i < MAX_MESSAGES) && (fight_messages[i].a_type != type) &&
(fight_messages[i].a_type); i++);
@ -120,9 +120,9 @@ void load_messages(void)
messages->god_msg.attacker_msg = fread_action(fl, i);
messages->god_msg.victim_msg = fread_action(fl, i);
messages->god_msg.room_msg = fread_action(fl, i);
buf = fgets(chk, 128, fl);
fgets(chk, 128, fl);
while (!feof(fl) && (*chk == '\n' || *chk == '*'))
buf = fgets(chk, 128, fl);
fgets(chk, 128, fl);
}
}
fclose(fl);
@ -145,7 +145,7 @@ static void show_messages(struct char_data *ch)
len += snprintf(buf + len, sizeof(buf) - len, "%-2d) [%-3d] %d, %-18s\r\n", half, fight_messages[half].a_type, fight_messages[half].number_of_attacks, fight_messages[half].a_type < TOP_SPELL_DEFINE ? spell_info[fight_messages[half].a_type].name : "Unknown");
}
len += snprintf(buf + len, sizeof(buf) - len, "Total Messages: %d\r\n", count);
snprintf(buf + len, sizeof(buf) - len, "Total Messages: %d\r\n", count);
page_string(ch->desc, buf, TRUE);
}

View file

@ -54,7 +54,6 @@ void init_events(void)
EVENTFUNC(event_countdown)
{
struct mud_event_data * pMudEvent;
struct char_data * ch = NULL;
struct room_data * room = NULL;
room_rnum rnum = NOWHERE;
@ -62,14 +61,13 @@ EVENTFUNC(event_countdown)
switch (mud_event_index[pMudEvent->iId].iEvent_Type) {
case EVENT_CHAR:
ch = (struct char_data * ) pMudEvent->pStruct;
break;
break;
case EVENT_ROOM:
room = (struct room_data * ) pMudEvent->pStruct;
rnum = real_room(room->number);
break;
break;
default:
break;
break;
}
switch (pMudEvent->iId) {

View file

@ -830,7 +830,6 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
size_mobiles = 0;
size_shops = 0;
size_trigs = 0;
size_quests = 0;
top = zone_table[rnum].top;
bottom = zone_table[rnum].bot;

View file

@ -53,7 +53,6 @@ ACMD(do_oasis_oedit)
{
int number = NOWHERE, save = 0, real_num;
struct descriptor_data *d;
char *buf3;
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
@ -62,7 +61,7 @@ ACMD(do_oasis_oedit)
return;
/* Parse any arguments. */
buf3 = two_arguments(argument, buf1, buf2);
two_arguments(argument, buf1, buf2);
/* If there aren't any arguments they can't modify anything. */
if (!*buf1) {

View file

@ -911,7 +911,6 @@ ACMD(do_oasis_prefedit)
{
struct descriptor_data *d;
struct char_data *vict;
char *buf3;
char buf[MAX_STRING_LENGTH];
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
@ -919,7 +918,7 @@ ACMD(do_oasis_prefedit)
/****************************************************************************/
/** Parse any arguments. **/
/****************************************************************************/
buf3 = two_arguments(argument, buf1, buf2);
two_arguments(argument, buf1, buf2);
/****************************************************************************/
/** If there aren't any arguments...well...they can only modify their **/

View file

@ -1530,7 +1530,6 @@ static void Negotiate( descriptor_t *apDescriptor )
static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProtocol )
{
bool_t bResult = true;
protocol_t *pProtocol = apDescriptor->pProtocol;
switch ( aProtocol )
@ -1559,8 +1558,6 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
Negotiate(apDescriptor);
}
}
else /* Anything else is invalid. */
bResult = false;
break;
case (char)TELOPT_NAWS:
@ -1568,8 +1565,6 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
pProtocol->bNAWS = true;
else if ( aCmd == (char)WONT )
pProtocol->bNAWS = false;
else /* Anything else is invalid. */
bResult = false;
break;
case (char)TELOPT_CHARSET:
@ -1581,8 +1576,6 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
}
else if ( aCmd == (char)WONT )
pProtocol->bCHARSET = false;
else /* Anything else is invalid. */
bResult = false;
break;
case (char)TELOPT_MSDP:
@ -1595,8 +1588,6 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
}
else if ( aCmd == (char)DONT )
pProtocol->bMSDP = false;
else /* Anything else is invalid. */
bResult = false;
break;
case (char)TELOPT_MSSP:
@ -1604,8 +1595,6 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
SendMSSP( apDescriptor );
else if ( aCmd == (char)DONT )
; /* Do nothing. */
else /* Anything else is invalid. */
bResult = false;
break;
case (char)TELOPT_MCCP:
@ -1619,8 +1608,6 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
pProtocol->bMCCP = false;
CompressEnd( apDescriptor );
}
else // Anything else is invalid.
bResult = false;
break;
case (char)TELOPT_MSP:
@ -1628,8 +1615,6 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
pProtocol->bMSP = true;
else if ( aCmd == (char)DONT )
pProtocol->bMSP = false;
else /* Anything else is invalid. */
bResult = false;
break;
case (char)TELOPT_MXP:
@ -1665,8 +1650,6 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
}
else if ( aCmd == (char)DONT )
pProtocol->bMXP = false;
else /* Anything else is invalid. */
bResult = false;
break;
case (char)TELOPT_ATCP:
@ -1692,12 +1675,10 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
}
else if ( aCmd == (char)WONT )
pProtocol->bATCP = false;
else /* Anything else is invalid. */
bResult = false;
break;
default:
bResult = false;
break;
}
}

View file

@ -55,14 +55,13 @@ ACMD(do_oasis_qedit)
int number = NOWHERE, save = 0;
qst_rnum real_num;
struct descriptor_data *d;
char *buf3;
char buf1[MAX_INPUT_LENGTH];
char buf2[MAX_INPUT_LENGTH];
/****************************************************************************/
/** Parse any arguments. **/
/****************************************************************************/
buf3 = two_arguments(argument, buf1, buf2);
two_arguments(argument, buf1, buf2);
if (!*buf1) {
send_to_char(ch, "Specify a quest VNUM to edit.\r\n");

View file

@ -34,7 +34,6 @@ static void redit_disp_menu(struct descriptor_data *d);
/* Utils and exported functions. */
ACMD(do_oasis_redit)
{
char *buf3;
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int number = NOWHERE, save = 0, real_num;
@ -45,7 +44,7 @@ ACMD(do_oasis_redit)
return;
/* Parse any arguments. */
buf3 = two_arguments(argument, buf1, buf2);
two_arguments(argument, buf1, buf2);
if (!*buf1)
number = GET_ROOM_VNUM(IN_ROOM(ch));

View file

@ -50,7 +50,6 @@ ACMD(do_oasis_sedit)
int number = NOWHERE, save = 0;
shop_rnum real_num;
struct descriptor_data *d;
char *buf3;
char buf1[MAX_INPUT_LENGTH];
char buf2[MAX_INPUT_LENGTH];
@ -59,7 +58,7 @@ ACMD(do_oasis_sedit)
return;
/* Parse any arguments. */
buf3 = two_arguments(argument, buf1, buf2);
two_arguments(argument, buf1, buf2);
if (!*buf1) {
send_to_char(ch, "Specify a shop VNUM to edit.\r\n");
@ -682,7 +681,6 @@ void sedit_parse(struct descriptor_data *d, char *arg)
/* Numerical responses. */
case SEDIT_KEEPER:
i = atoi(arg);
if ((i = atoi(arg)) != -1)
if ((i = real_mobile(i)) == NOBODY) {
write_to_output(d, "That mobile does not exist, try again : ");

View file

@ -1083,13 +1083,13 @@ static int read_type_list(FILE *shop_f, struct shop_buy_data *list,
int new_format, int max)
{
int tindex, num, len = 0, error = 0;
char *ptr, buf[MAX_STRING_LENGTH], *buf1;
char *ptr, buf[MAX_STRING_LENGTH];
if (!new_format)
return (read_list(shop_f, list, 0, max, LIST_TRADE));
do {
buf1 = fgets(buf, sizeof(buf), shop_f);
fgets(buf, sizeof(buf), shop_f);
if ((ptr = strchr(buf, ';')) != NULL)
*ptr = '\0';
else

View file

@ -333,9 +333,7 @@ ASPELL(spell_identify)
}
if (GET_OBJ_VAL(obj, 3) >= 1 && len < sizeof(bitbuf)) {
i = snprintf(bitbuf + len, sizeof(bitbuf) - len, " %s", skill_name(GET_OBJ_VAL(obj, 3)));
if (i >= 0)
len += i;
snprintf(bitbuf + len, sizeof(bitbuf) - len, " %s", skill_name(GET_OBJ_VAL(obj, 3)));
}
send_to_char(ch, "This %s casts: %s\r\n", item_types[(int) GET_OBJ_TYPE(obj)], bitbuf);