comparison 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
comparison
equal deleted inserted replaced
229:50b89f165a34 233:0990adf580ee
20 10L,20L,40L,80L,160L,320L,640L,1280L,2560L,5120L,10240L,20480L, 20 10L,20L,40L,80L,160L,320L,640L,1280L,2560L,5120L,10240L,20480L,
21 40920L, 81920L, 163840L, 327680L, 655360L, 1310720L, 2621440L, 0L 21 40920L, 81920L, 163840L, 327680L, 655360L, 1310720L, 2621440L, 0L
22 }; 22 };
23 23
24 bool roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl); 24 bool roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl);
25 void hit(char *er, char *ee); 25 void hit(const char *er, const char *ee);
26 void miss(char *er, char *ee); 26 void miss(const char *er, const char *ee);
27 int str_plus(str_t str); 27 int str_plus(str_t str);
28 int add_dam(str_t str); 28 int add_dam(str_t str);
29 void thunk(THING *weap, const char *mname); 29 void thunk(THING *weap, const char *mname);
30 void bounce(THING *weap, const char *mname); 30 void bounce(THING *weap, const char *mname);
31 31
444 /* 444 /*
445 * prname: 445 * prname:
446 * The print name of a combatant 446 * The print name of a combatant
447 */ 447 */
448 char * 448 char *
449 prname(char *who, bool upper) 449 prname(const char *who, bool upper)
450 { 450 {
451 static char tbuf[MAXSTR]; 451 static char tbuf[MAXSTR];
452 452
453 *tbuf = '\0'; 453 *tbuf = '\0';
454 if (who == 0) 454 if (who == 0)
468 /* 468 /*
469 * hit: 469 * hit:
470 * Print a message to indicate a succesful hit 470 * Print a message to indicate a succesful hit
471 */ 471 */
472 void 472 void
473 hit(char *er, char *ee) 473 hit(const char *er, const char *ee)
474 { 474 {
475 register char *s = ""; 475 register char *s = "";
476 476
477 addmsg(prname(er, TRUE)); 477 addmsg(prname(er, TRUE));
478 if (terse) 478 if (terse)
494 /* 494 /*
495 * miss: 495 * miss:
496 * Print a message to indicate a poor swing 496 * Print a message to indicate a poor swing
497 */ 497 */
498 void 498 void
499 miss(char *er, char *ee) 499 miss(const char *er, const char *ee)
500 { 500 {
501 register char *s = ""; 501 register char *s = "";
502 502
503 addmsg(prname(er, TRUE)); 503 addmsg(prname(er, TRUE));
504 switch (terse ? 0 : rnd(4)) 504 switch (terse ? 0 : rnd(4))