Super-Rogue: fix some out-of-range constants.
Constants K_ARROW etc., for causes of death other than monsters, are in the 240-255 range. They were often passed to functions taking char, which is usually signed, making the values out of range. The function declarations have been changed to unsigned char, which is also the type used by the scoreboard code.
This commit is contained in:
parent
844379d679
commit
3ac49bdaa0
3 changed files with 8 additions and 8 deletions
|
|
@ -21,7 +21,7 @@ int hungdam(void);
|
||||||
* Changes players hit points
|
* Changes players hit points
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
chg_hpt(int howmany, bool alsomax, char what)
|
chg_hpt(int howmany, bool alsomax, unsigned char what)
|
||||||
{
|
{
|
||||||
nochange = FALSE;
|
nochange = FALSE;
|
||||||
if(alsomax)
|
if(alsomax)
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ void showpack(bool winner, char *howso);
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
void
|
void
|
||||||
death(char monst)
|
death(unsigned char monst)
|
||||||
{
|
{
|
||||||
reg char *killer;
|
reg char *killer;
|
||||||
int dp;
|
int dp;
|
||||||
|
|
@ -122,7 +122,7 @@ int oldpurse;
|
||||||
* Figure score and post it.
|
* Figure score and post it.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
score(int amount, int aflag, char monst)
|
score(int amount, int aflag, unsigned char monst)
|
||||||
{
|
{
|
||||||
reg struct sc_ent *scp, *sc2;
|
reg struct sc_ent *scp, *sc2;
|
||||||
reg int i, prflags = 0;
|
reg int i, prflags = 0;
|
||||||
|
|
@ -219,7 +219,7 @@ score(int amount, int aflag, char monst)
|
||||||
showtop(prflags); /* print top ten list */
|
showtop(prflags); /* print top ten list */
|
||||||
}
|
}
|
||||||
|
|
||||||
void writelog(int amount, int aflag, char monst)
|
void writelog(int amount, int aflag, unsigned char monst)
|
||||||
{
|
{
|
||||||
char logmessage[220], ltemp[80], mlev[40];
|
char logmessage[220], ltemp[80], mlev[40];
|
||||||
char *killer;
|
char *killer;
|
||||||
|
|
|
||||||
|
|
@ -62,14 +62,14 @@ bool cansee(int y, int x);
|
||||||
char *charge_str(struct object *obj);
|
char *charge_str(struct object *obj);
|
||||||
void check_level(void);
|
void check_level(void);
|
||||||
void chg_abil(int what, int amt, int how);
|
void chg_abil(int what, int amt, int how);
|
||||||
void chg_hpt(int howmany, bool alsomax, char what);
|
void chg_hpt(int howmany, bool alsomax, unsigned char what);
|
||||||
void command(void);
|
void command(void);
|
||||||
bool cordok(int y, int x);
|
bool cordok(int y, int x);
|
||||||
void create_obj(bool fscr);
|
void create_obj(bool fscr);
|
||||||
void cur_null(struct object *op);
|
void cur_null(struct object *op);
|
||||||
void dbotline(WINDOW *scr, char *message);
|
void dbotline(WINDOW *scr, char *message);
|
||||||
bool dead_end(char ch);
|
bool dead_end(char ch);
|
||||||
void death(char monst);
|
void death(unsigned char monst);
|
||||||
void del_pack(struct linked_list *what);
|
void del_pack(struct linked_list *what);
|
||||||
bool diag_ok(struct coord *sp, struct coord *ep);
|
bool diag_ok(struct coord *sp, struct coord *ep);
|
||||||
void dip_it(void);
|
void dip_it(void);
|
||||||
|
|
@ -208,7 +208,7 @@ void sapem(int fromfuse);
|
||||||
bool save(int which);
|
bool save(int which);
|
||||||
bool save_game(void);
|
bool save_game(void);
|
||||||
bool save_throw(int which, struct thing *tp);
|
bool save_throw(int which, struct thing *tp);
|
||||||
void score(int amount, int aflag, char monst);
|
void score(int amount, int aflag, unsigned char monst);
|
||||||
void sell_it(void);
|
void sell_it(void);
|
||||||
void setoflg(struct object *what, long bit);
|
void setoflg(struct object *what, long bit);
|
||||||
void setup(void);
|
void setup(void);
|
||||||
|
|
@ -244,4 +244,4 @@ void wghtchk(int fromfuse);
|
||||||
void whatis(struct linked_list *what);
|
void whatis(struct linked_list *what);
|
||||||
void wield(void);
|
void wield(void);
|
||||||
char winat(int y, int x);
|
char winat(int y, int x);
|
||||||
void writelog(int amount, int aflag, char monst);
|
void writelog(int amount, int aflag, unsigned char monst);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue