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

@ -288,10 +288,10 @@ baf_print_item(struct object *obj_p, bag_arg *type, int id)
if (*type->iarg == 0)
sprintf(inv_temp, "%c%c) %s", obj_p->o_type,
print_letters[id], inv_name(obj_p, LOWERCASE), FALSE);
print_letters[id], inv_name(obj_p, LOWERCASE));
else
sprintf(inv_temp, "%c) %s", print_letters[id],
inv_name(obj_p, LOWERCASE), FALSE);
inv_name(obj_p, LOWERCASE));
add_line(inv_temp);
return(TRUE);

View file

@ -1143,8 +1143,8 @@ get_hurl(struct thing *tp)
if (off(*tp, ISCHARMED) && oil)
return(oil);
if (off(*tp, ISCHARMED) && grenade)
return(grenade);
if (off(*tp, ISCHARMED) && grenade)
return(grenade);
if (footbow && fbbolt)
return(fbbolt);

View file

@ -152,7 +152,7 @@ puta_player(void)
wclrtoeol(hw);
sprintf(pbuf,
"Int: %d Str: %d Wis: %d Dex: %d Con: %d Cha: %d Pow: %d Hpt: %d",
"Int: %d Str: %d Wis: %d Dex: %d Con: %d Cha: %d Pow: %d Hpt: %ld",
pstats.s_intel,
pstats.s_str,
pstats.s_wisdom,

View file

@ -161,7 +161,7 @@ status(int display)
mvwaddstr(cw, LINES - 2, 0, buf);
wclrtoeol(cw);
sprintf(buf, "Lvl:%d Au:%d Hpt:%3d(%3d) Pow:%d(%d) Ac:%d Exp:%d+%ld %s",
sprintf(buf, "Lvl:%d Au:%ld Hpt:%3ld(%3ld) Pow:%d(%d) Ac:%d Exp:%d+%ld %s",
level,
purse,
stat_ptr->s_hpt, max_ptr->s_hpt,

View file

@ -1417,11 +1417,11 @@ sell(struct thing *tp)
if (selection[i].count > 1)
strcat(dbuf, "s");
sprintf(buffer, "%-50s Price: %d", dbuf, selection[i].worth);
sprintf(buffer, "%-50.80s Price: %d", dbuf, selection[i].worth);
waddstr(hw, buffer);
}
sprintf(buffer, "Purse: %d", purse);
sprintf(buffer, "Purse: %ld", purse);
mvwaddstr(hw, nitems + 3, 0, buffer);
mvwaddstr(hw, 0, 0, "How about one of the following goods? ");
wrefresh(hw);

View file

@ -29,15 +29,19 @@ int get_score(opt_arg *opt, WINDOW *win);
/* description of an option and what to do with it */
static OPTION optlist[] =
{
{"jump","Show position only at end of run (jump): ", &jump,put_bool,get_bool},
{"inven","Style of inventories (inven): ", &inv_type, put_inv, get_inv},
{"askme","Ask me about unidentified things (askme): ",&askme,put_bool,get_bool},
{"doorstop","Stop running when adjacent (doorstop): ",&doorstop,put_bool,get_bool},
{"name", "Name (name): ", &whoami, put_str, get_restr},
{"fruit", "Fruit (fruit): ", &fruit, put_str, get_str},
{"file", "Save file (file): ", &file_name, put_str, get_restr},
{"score", "Score file (score): ", &score_file, put_str, get_score},
{"class", "Character class (class): ",&char_type, put_abil, get_abil}
{"jump","Show position only at end of run (jump): ", { &jump },
put_bool, get_bool},
{"inven","Style of inventories (inven): ", { &inv_type },
put_inv, get_inv},
{"askme","Ask me about unidentified things (askme): ", { &askme},
put_bool, get_bool},
{"doorstop","Stop running when adjacent (doorstop): ", { &doorstop },
put_bool, get_bool},
{"name", "Name (name): ", { &whoami }, put_str, get_restr},
{"fruit", "Fruit (fruit): ", { &fruit }, put_str, get_str},
{"file", "Save file (file): ", { &file_name }, put_str, get_restr},
{"score", "Score file (score): ", { &score_file }, put_str, get_score},
{"class", "Character class (class): ", { &char_type }, put_abil, get_abil}
};
/*

View file

@ -215,33 +215,33 @@ quaff(struct thing *quaffer, int which, int flags)
case 2: ctype = C_CLERIC; break;
case 3: ctype = C_THIEF; break;
}
switch (ctype)
{
case C_FIGHTER:add_strength(cursed); break;
case C_PALADIN:add_strength(cursed); break;
case C_RANGER:add_strength(cursed); break;
case C_MAGICIAN:add_intelligence(cursed); break;
case C_ILLUSION:add_intelligence(cursed); break;
case C_CLERIC:add_wisdom(cursed); break;
case C_DRUID:add_wisdom(cursed); break;
case C_THIEF:add_dexterity(cursed); break;
case C_ASSASIN:add_dexterity(cursed); break;
case C_NINJA:add_dexterity(cursed); break;
default: msg("You're a strange type!"); break;
}
switch (ctype)
{
case C_FIGHTER:add_strength(cursed); break;
case C_PALADIN:add_strength(cursed); break;
case C_RANGER:add_strength(cursed); break;
case C_MAGICIAN:add_intelligence(cursed); break;
case C_ILLUSION:add_intelligence(cursed); break;
case C_CLERIC:add_wisdom(cursed); break;
case C_DRUID:add_wisdom(cursed); break;
case C_THIEF:add_dexterity(cursed); break;
case C_ASSASIN:add_dexterity(cursed); break;
case C_NINJA:add_dexterity(cursed); break;
default: msg("You're a strange type!"); break;
}
if (rnd(100) < 10)
add_const(cursed);
if (rnd(100) < 60)
curp->s_arm += (cursed ? 1 : -1);
if (!cursed)
know_items[TYP_POTION][P_GAINABIL] = TRUE;
}
if (rnd(100) < 10)
add_const(cursed);
if (rnd(100) < 60)
curp->s_arm += (cursed ? 1 : -1);
if (!cursed)
know_items[TYP_POTION][P_GAINABIL] = TRUE;
}
break;
}
break;
case P_MONSTDET:

View file

@ -408,8 +408,8 @@ writelog(long amount, int lvl, int flags, int monst)
}
else
return;
fprintf(file_log, "%d %d %s %d %s %d %d %d %s\n", time(NULL), amount,
whoami, lvl, which_class(player.t_ctype), level, max_level,
fprintf(file_log, "%ld %ld %s %d %s %d %d %d %s\n", time(NULL), amount,
whoami, lvl, which_class(player.t_ctype), level, max_level,
has_artifact, fate);
fclose(file_log);
return;

View file

@ -573,7 +573,7 @@ find_object(struct linked_list *list, int num)
if ( (num < 1) || (list == NULL) )
return(NULL);
num--;
num--;
for(cnt = 0; cnt < num; cnt++)
{

View file

@ -257,7 +257,7 @@ buy_more:
for(i=0,m_item=magic_array; i < array_size; i++, m_item++)
if (!is_spell && m_item->mi_worth > 0)
{
sprintf(buf, "%3d) %8d %s", i, m_item->mi_worth,
sprintf(buf, "%3d) %8ld %s", i, m_item->mi_worth,
m_item->mi_name);
add_line(buf);
}
@ -267,7 +267,7 @@ buy_more:
for (i = 0; i < array_size; i++)
if (!is_spell && armors[i].a_worth > 0)
{
sprintf(buf, "%3d) %8d %s", i, armors[i].a_worth,
sprintf(buf, "%3d) %8ld %s", i, armors[i].a_worth,
armors[i].a_name);
add_line(buf);
@ -278,7 +278,7 @@ buy_more:
for (i = 0; i < array_size; i++)
if (!is_spell && weaps[i].w_worth > 0)
{
sprintf(buf, "%3d) %8d %s", i, weaps[i].w_worth,
sprintf(buf, "%3d) %8ld %s", i, weaps[i].w_worth,
weaps[i].w_name);
add_line(buf);
}
@ -646,7 +646,7 @@ describe_it(struct object *obj)
else
charp = normal_d[rnd(sizeof(normal_d) / sizeof(char *))];
sprintf(buf, "It's a%s %s worth %d pieces of gold.",
sprintf(buf, "It's a%s %s worth %ld pieces of gold.",
vowelstr(charp), charp, obj->o_worth);
mvwaddstr(hw, 10, 0, inv_name(obj, TRUE));
@ -794,11 +794,11 @@ trans_line(void)
int adorned = is_wearing(R_ADORNMENT);
if (level == 0 && purse > 0)
sprintf(buf, "You still have %d pieces of gold left.", purse);
sprintf(buf, "You still have %ld pieces of gold left.", purse);
else if (purse == 0)
sprintf(buf, "You have no money left.");
else if (!wizard)
sprintf(buf, "You have %d transactions and %d gold pieces remaining.",
sprintf(buf, "You have %d transactions and %ld gold pieces remaining.",
max(0, (adorned ? MAXPURCH + 4 : MAXPURCH) - player.t_trans),
EFFECTIVE_PURSE);
else