Fix an assortment of compiler warnings.

A few potential bugs were removed in the process.  Much code cleanup
remains to be done.
This commit is contained in:
John "Elwin" Edwards 2019-11-22 21:18:27 -05:00
parent de95b19cee
commit 7d459d7d36
47 changed files with 608 additions and 591 deletions

View file

@ -179,52 +179,52 @@ struct monster monsters[MAXMONS + 1] = {
#undef _r
struct h_list helpstr[] = {
'?', " prints help",
'/', " identify object",
'h', " left",
'j', " down",
'k', " up",
'l', " right",
'y', " up & left",
'u', " up & right",
'b', " down & left",
'n', " down & right",
'H', " run left",
'J', " run down",
'K', " run up",
'L', " run right",
'Y', " run up & left",
'U', " run up & right",
'B', " run down & left",
'N', " run down & right",
't', "<dir> throw something",
'f', "<dir> forward until find something",
'p', "<dir> zap a wand in a direction",
'z', " zap a wand or staff",
'>', " go down a staircase",
's', " search for trap/secret door",
'.', " (dot) rest for a while",
'i', " inventory pack",
'I', " inventory single item",
'q', " quaff potion",
'r', " read a scroll",
'e', " eat food",
'w', " wield a weapon",
'W', " wear armor",
'T', " take armor off",
'P', " put on ring",
'R', " remove ring",
'd', " drop object",
'c', " call object",
'O', " examine/set options",
'a', " display maximum stats",
'D', " dip object in pool",
CTRL('L')," redraw screen",
ESCAPE, " cancel command",
'!', " shell escape",
'S', " save game",
'Q', " quit",
0, 0
{ '?', " prints help" },
{ '/', " identify object" },
{ 'h', " left" },
{ 'j', " down" },
{ 'k', " up" },
{ 'l', " right" },
{ 'y', " up & left" },
{ 'u', " up & right" },
{ 'b', " down & left" },
{ 'n', " down & right" },
{ 'H', " run left" },
{ 'J', " run down" },
{ 'K', " run up" },
{ 'L', " run right" },
{ 'Y', " run up & left" },
{ 'U', " run up & right" },
{ 'B', " run down & left" },
{ 'N', " run down & right" },
{ 't', "<dir> throw something" },
{ 'f', "<dir> forward until find something" },
{ 'p', "<dir> zap a wand in a direction" },
{ 'z', " zap a wand or staff" },
{ '>', " go down a staircase" },
{ 's', " search for trap/secret door" },
{ '.', " (dot) rest for a while" },
{ 'i', " inventory pack" },
{ 'I', " inventory single item" },
{ 'q', " quaff potion" },
{ 'r', " read a scroll" },
{ 'e', " eat food" },
{ 'w', " wield a weapon" },
{ 'W', " wear armor" },
{ 'T', " take armor off" },
{ 'P', " put on ring" },
{ 'R', " remove ring" },
{ 'd', " drop object" },
{ 'c', " call object" },
{ 'O', " examine/set options" },
{ 'a', " display maximum stats" },
{ 'D', " dip object in pool" },
{ CTRL('L')," redraw screen" },
{ ESCAPE, " cancel command" },
{ '!', " shell escape" },
{ 'S', " save game" },
{ 'Q', " quit" },
{ 0, 0 }
};
char *s_names[MAXSCROLLS]; /* Names of the scrolls */

View file

@ -100,7 +100,7 @@ new(int size)
register char *space = ALLOC(size);
if (space == NULL) {
sprintf(prbuf,"Rogue ran out of memory (%d).", md_memused());
sprintf(prbuf,"Rogue ran out of memory (%ld).", md_memused());
fatal(prbuf);
}
total++;

View file

@ -47,7 +47,8 @@ main(int argc, char *argv[], char *envp[])
register char *env;
register struct linked_list *item;
register struct object *obj;
char alldone, wpt;
char alldone;
int wpt;
char *getpass(), *xcrypt(), *strrchr();
char *homedir = roguehome();

View file

@ -63,7 +63,8 @@ void showpack(bool winner, char *howso);
void
death(char monst)
{
reg char dp, *killer;
reg char *killer;
int dp;
struct tm *lt;
time_t date;
char buf[LINLEN];
@ -180,21 +181,21 @@ score(int amount, int aflag, char monst)
for (scp = top_ten; scp <= &top_ten[9]; scp++)
if (amount > scp->sc_score)
break;
if (scp <= &top_ten[9]) {
for (sc2 = &top_ten[9]; sc2 > scp; sc2--)
*sc2 = *(sc2-1);
scp->sc_score = amount;
strcpy(scp->sc_name, whoami);
scp->sc_flags = aflag;
if (aflag == WINNER)
scp->sc_level = max_level;
else
scp->sc_level = level;
scp->sc_monster = monst;
scp->sc_uid = playuid;
scp->sc_explvl = him->s_lvl;
scp->sc_exppts = him->s_exp;
time(&scp->sc_date);
if (scp <= &top_ten[9]) {
for (sc2 = &top_ten[9]; sc2 > scp; sc2--)
*sc2 = *(sc2-1);
scp->sc_score = amount;
strcpy(scp->sc_name, whoami);
scp->sc_flags = aflag;
if (aflag == WINNER)
scp->sc_level = max_level;
else
scp->sc_level = level;
scp->sc_monster = monst;
scp->sc_uid = playuid;
scp->sc_explvl = him->s_lvl;
scp->sc_exppts = him->s_exp;
time(&scp->sc_date);
}
}
ignore();
@ -228,7 +229,7 @@ void writelog(int amount, int aflag, char monst)
#ifdef LOGFILE
if (logfile == NULL)
return;
sprintf(logmessage, "%d %d %s %d ", time(NULL), amount, whoami,
sprintf(logmessage, "%ld %d %s %d ", time(NULL), amount, whoami,
him->s_lvl);
if (amulet)
sprintf(mlev, " [max %d] with the Amulet", max_level);

View file

@ -79,7 +79,7 @@ inv_name(struct object *obj, bool drop)
if (wh == 1) {
if (obj->o_count == 1)
q = vowelstr(fruit);
sprintf(prbuf, "%s%s %s%s", nm, q, fruit, pl);
sprintf(prbuf, "%s%s %.72s%s", nm, q, fruit, pl);
}
else {
if (obj->o_count == 1)

View file

@ -338,7 +338,7 @@ struct cell {
char x_pos;
};
struct bordercells {
char num_pos; /* number of frontier cells next to you */
unsigned char num_pos; /* number of frontier cells next to you */
struct cell conn[4]; /* the y,x position of above cell */
} mborder;