Rogue V4: add two more function declarations.

Though it was called with different numbers of arguments, add_line()
does not need to be a variadic function.  Making the second argument
mandatory is a better solution.
This commit is contained in:
John "Elwin" Edwards 2016-03-07 19:26:08 -05:00
parent a6c73eb65a
commit 090622896b
2 changed files with 12 additions and 10 deletions

View file

@ -484,6 +484,7 @@ void _attach(THING **list, THING *item);
void _detach(THING **list, THING *item); void _detach(THING **list, THING *item);
void _free_list(THING **ptr); void _free_list(THING **ptr);
bool add_haste(bool potion); bool add_haste(bool potion);
void add_line(char *fmt, char *arg);
void add_pack(THING *obj, bool silent); void add_pack(THING *obj, bool silent);
void add_str(str_t *sp, int amt); void add_str(str_t *sp, int amt);
void addmsg(char *fmt, ...); void addmsg(char *fmt, ...);
@ -515,6 +516,7 @@ bool dropcheck(THING *op);
void eat(void); void eat(void);
int encread(void *starta, int size, int inf); int encread(void *starta, int size, int inf);
void encwrite(void *starta, int size, FILE *outf); void encwrite(void *starta, int size, FILE *outf);
void end_line(void);
void endmsg(void); void endmsg(void);
void enter_room(coord *cp); void enter_room(coord *cp);
void extinguish(void (*func)()); void extinguish(void (*func)());

View file

@ -438,11 +438,11 @@ discovered(void)
if (ch == '*') if (ch == '*')
{ {
print_disc(POTION); print_disc(POTION);
add_line(""); add_line("", NULL);
print_disc(SCROLL); print_disc(SCROLL);
add_line(""); add_line("", NULL);
print_disc(RING); print_disc(RING);
add_line(""); add_line("", NULL);
print_disc(STICK); print_disc(STICK);
end_line(); end_line();
} }
@ -505,7 +505,7 @@ print_disc(char type)
num_found++; num_found++;
} }
if (num_found == 0) if (num_found == 0)
add_line(nothing(type)); add_line(nothing(type), NULL);
} }
/* /*
@ -533,9 +533,8 @@ set_order(short *order, int numthings)
* add_line: * add_line:
* Add a line to the list of discoveries * Add a line to the list of discoveries
*/ */
/* VARARGS1 */ void
add_line(fmt, arg) add_line(char *fmt, char *arg)
char *fmt, *arg;
{ {
if (line_cnt == 0) if (line_cnt == 0)
{ {
@ -545,7 +544,7 @@ char *fmt, *arg;
} }
if (slow_invent) if (slow_invent)
{ {
if (*fmt != '\0') if (fmt != NULL && *fmt != '\0')
msg(fmt, arg); msg(fmt, arg);
line_cnt++; line_cnt++;
} }
@ -575,7 +574,8 @@ char *fmt, *arg;
* end_line: * end_line:
* End the list of lines * End the list of lines
*/ */
end_line() void
end_line(void)
{ {
if (!slow_invent) if (!slow_invent)
if (line_cnt == 1 && !newpage) if (line_cnt == 1 && !newpage)
@ -584,7 +584,7 @@ end_line()
msg(lastfmt, lastarg); msg(lastfmt, lastarg);
} }
else else
add_line(NULL); add_line(NULL, NULL);
line_cnt = 0; line_cnt = 0;
newpage = FALSE; newpage = FALSE;
} }