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

@ -145,21 +145,25 @@ struct stats max_stats = INIT_STATS; /* The maximum for the player */
struct room *oldrp; /* Roomin(&oldpos) */
struct room rooms[MAXROOMS]; /* One for each room -- A level */
#define NON {0, 0}
#define NON12 { NON, NON, NON, NON, NON, NON, NON, NON, NON, NON, NON, NON }
struct room passages[MAXPASS] = /* One for each passage */
{
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 },
{ {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, NON12 }
};
#undef NON12
#undef NON
#define ___ 1
#define XX 10
@ -276,51 +280,51 @@ struct magic_item ws_magic[MAXSTICKS] = {
};
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",
'z', "<dir> zap a wand in a direction",
'^', "<dir> identify trap type",
's', " search for trap/secret door",
'>', " go down a staircase",
'<', " go up a staircase",
'.', " rest for a while",
'i', " inventory",
'I', " inventory single item",
'q', " quaff potion",
'r', " read paper",
'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",
'D', " recall what's been discovered",
'o', " examine/set options",
CTRL('L'), " redraw screen",
CTRL('R'), " repeat last message",
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" },
{ 'z', "<dir> zap a wand in a direction" },
{ '^', "<dir> identify trap type" },
{ 's', " search for trap/secret door" },
{ '>', " go down a staircase" },
{ '<', " go up a staircase" },
{ '.', " rest for a while" },
{ 'i', " inventory" },
{ 'I', " inventory single item" },
{ 'q', " quaff potion" },
{ 'r', " read paper" },
{ '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" },
{ 'D', " recall what's been discovered" },
{ 'o', " examine/set options" },
{ CTRL('L'), " redraw screen" },
{ CTRL('R'), " repeat last message" },
{ ESCAPE, " cancel command" },
{ '!', " shell escape" },
{ 'S', " save game" },
{ 'Q', " quit" },
{ 0, 0 }
};

View file

@ -259,7 +259,7 @@ eat(void)
else
msg("yum, that tasted good");
if (--obj->o_count < 1)
if (--obj->o_count < 1)
{
detach(pack, obj);
discard(obj);

View file

@ -136,7 +136,7 @@ void
conn(int r1, int r2)
{
register struct room *rpf, *rpt = NULL;
register char rmt;
unsigned char rmt;
register int distance = 0, turn_spot = 0, turn_distance = 0, index;
register int rm;
register char direc;

View file

@ -241,7 +241,7 @@ void writelog(int amount, int flags, char monst)
if (log_file == NULL)
return;
/* otherwise writing should work */
sprintf(logmessage, "%d %d %s %d ", time(NULL), amount, whoami,
sprintf(logmessage, "%ld %d %s %d ", time(NULL), amount, whoami,
pstats.s_lvl);
if (flags == 0) /* died */
{

View file

@ -79,9 +79,9 @@ inv_name(THING *obj, bool drop)
when FOOD:
if (obj->o_which == 1)
if (obj->o_count == 1)
sprintf(pb, "A%s %s", vowelstr(fruit), fruit);
sprintf(pb, "A%s %.76s", vowelstr(fruit), fruit);
else
sprintf(pb, "%d %ss", obj->o_count, fruit);
sprintf(pb, "%d %.66ss", obj->o_count, fruit);
else
if (obj->o_count == 1)
strcpy(pb, "Some food");

View file

@ -23,16 +23,16 @@ static struct init_weps {
char iw_launch; /* Launching weapon */
int iw_flags; /* Miscellaneous flags */
} init_dam[MAXWEAPONS] = {
"2d4", "1d3", NONE, 0, /* Mace */
"3d4", "1d2", NONE, 0, /* Long sword */
"1d1", "1d1", NONE, 0, /* Bow */
"1d1", "2d3", BOW, ISMANY|ISMISL, /* Arrow */
"1d6", "1d4", NONE, ISMISL, /* Dagger */
"4d4", "1d2", NONE, 0, /* 2h sword */
"1d1", "1d3", NONE, ISMANY|ISMISL, /* Dart */
"1d1", "1d1", NONE, 0, /* Crossbow */
"1d2", "2d5", CROSSBOW, ISMANY|ISMISL, /* Crossbow bolt */
"2d3", "1d6", NONE, ISMISL, /* Spear */
{ "2d4", "1d3", NONE, 0 }, /* Mace */
{ "3d4", "1d2", NONE, 0 }, /* Long sword */
{ "1d1", "1d1", NONE, 0 }, /* Bow */
{ "1d1", "2d3", BOW, ISMANY|ISMISL },/* Arrow */
{ "1d6", "1d4", NONE, ISMISL }, /* Dagger */
{ "4d4", "1d2", NONE, 0 }, /* 2h sword */
{ "1d1", "1d3", NONE, ISMANY|ISMISL },/* Dart */
{ "1d1", "1d1", NONE, 0 }, /* Crossbow */
{ "1d2", "2d5", CROSSBOW, ISMANY|ISMISL },/* Crossbow bolt */
{ "2d3", "1d6", NONE, ISMISL } /* Spear */
};
/*