Mercurial > hg > early-roguelike
diff rogue4/fight.c @ 233:0990adf580ee
Declare some function arguments as const.
Some functions, mostly in fight.c, declared variables as pointers to
const char but passed them to functions that took pointers to ordinary
char. The strings did not actually get modified, so adding 'const' to
the function definitions removed the warnings.
author | John "Elwin" Edwards |
---|---|
date | Sun, 06 Mar 2016 19:32:47 -0500 |
parents | 1b73a8641b37 |
children | e7aab31362af |
line wrap: on
line diff
--- a/rogue4/fight.c Sun Mar 06 14:45:18 2016 -0500 +++ b/rogue4/fight.c Sun Mar 06 19:32:47 2016 -0500 @@ -22,8 +22,8 @@ }; bool roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl); -void hit(char *er, char *ee); -void miss(char *er, char *ee); +void hit(const char *er, const char *ee); +void miss(const char *er, const char *ee); int str_plus(str_t str); int add_dam(str_t str); void thunk(THING *weap, const char *mname); @@ -446,7 +446,7 @@ * The print name of a combatant */ char * -prname(char *who, bool upper) +prname(const char *who, bool upper) { static char tbuf[MAXSTR]; @@ -470,7 +470,7 @@ * Print a message to indicate a succesful hit */ void -hit(char *er, char *ee) +hit(const char *er, const char *ee) { register char *s = ""; @@ -496,7 +496,7 @@ * Print a message to indicate a poor swing */ void -miss(char *er, char *ee) +miss(const char *er, const char *ee) { register char *s = "";