comparison rogue4/things.c @ 215:1b73a8641b37

rogue4: fix most GCC5 warnings. Converting all function definitions to ANSI style accounts for most of the change. This has exposed other problems, such as daemons not actually being their stated type, that will require more careful solutions.
author John "Elwin" Edwards
date Wed, 27 Jan 2016 19:41:05 -0500
parents 9535a08ddc39
children 2dcf10d45d5b
comparison
equal deleted inserted replaced
214:e5a15b09ce1d 215:1b73a8641b37
14 #include <curses.h> 14 #include <curses.h>
15 #include <ctype.h> 15 #include <ctype.h>
16 #include <string.h> 16 #include <string.h>
17 #include "rogue.h" 17 #include "rogue.h"
18 18
19 int pick_one(struct magic_item *magic, int nitems);
20 void print_disc(char type);
21 void set_order(short *order, int numthings);
22 char *nothing(char type);
23
19 bool got_genocide = FALSE; 24 bool got_genocide = FALSE;
20 25
21 /* 26 /*
22 * inv_name: 27 * inv_name:
23 * Return the name of something as it would appear in an 28 * Return the name of something as it would appear in an
24 * inventory. 29 * inventory.
25 */ 30 */
26 char * 31 char *
27 inv_name(obj, drop) 32 inv_name(THING *obj, bool drop)
28 register THING *obj;
29 register bool drop;
30 { 33 {
31 register char *pb; 34 register char *pb;
32 35
33 pb = prbuf; 36 pb = prbuf;
34 switch (obj->o_type) 37 switch (obj->o_type)
161 164
162 /* 165 /*
163 * drop: 166 * drop:
164 * Put something down 167 * Put something down
165 */ 168 */
166 drop() 169 void
170 drop(void)
167 { 171 {
168 register char ch; 172 register char ch;
169 register THING *nobj, *op; 173 register THING *nobj, *op;
170 174
171 ch = chat(hero.y, hero.x); 175 ch = chat(hero.y, hero.x);
209 213
210 /* 214 /*
211 * dropcheck: 215 * dropcheck:
212 * Do special checks for dropping or unweilding|unwearing|unringing 216 * Do special checks for dropping or unweilding|unwearing|unringing
213 */ 217 */
214 dropcheck(op) 218 bool
215 register THING *op; 219 dropcheck(THING *op)
216 { 220 {
217 if (op == NULL) 221 if (op == NULL)
218 return TRUE; 222 return TRUE;
219 if (op != cur_armor && op != cur_weapon 223 if (op != cur_armor && op != cur_weapon
220 && op != cur_ring[LEFT] && op != cur_ring[RIGHT]) 224 && op != cur_ring[LEFT] && op != cur_ring[RIGHT])
251 /* 255 /*
252 * new_thing: 256 * new_thing:
253 * Return a new thing 257 * Return a new thing
254 */ 258 */
255 THING * 259 THING *
256 new_thing() 260 new_thing(void)
257 { 261 {
258 register THING *cur; 262 register THING *cur;
259 register int j, k; 263 register int j, k;
260 264
261 cur = new_item(); 265 cur = new_item();
359 363
360 /* 364 /*
361 * pick_one: 365 * pick_one:
362 * Pick an item out of a list of nitems possible magic items 366 * Pick an item out of a list of nitems possible magic items
363 */ 367 */
364 pick_one(magic, nitems) 368 int
365 register struct magic_item *magic; 369 pick_one(struct magic_item *magic, int nitems)
366 int nitems;
367 { 370 {
368 register struct magic_item *end; 371 register struct magic_item *end;
369 register int i; 372 register int i;
370 register struct magic_item *start; 373 register struct magic_item *start;
371 374
396 399
397 static bool newpage = FALSE; 400 static bool newpage = FALSE;
398 401
399 static char *lastfmt, *lastarg; 402 static char *lastfmt, *lastarg;
400 403
401 discovered() 404 void
405 discovered(void)
402 { 406 {
403 register char ch; 407 register char ch;
404 register bool disc_list; 408 register bool disc_list;
405 409
406 do { 410 do {
454 * Print what we've discovered of type 'type' 458 * Print what we've discovered of type 'type'
455 */ 459 */
456 460
457 #define MAX(a,b,c,d) (a > b ? (a > c ? (a > d ? a : d) : (c > d ? c : d)) : (b > c ? (b > d ? b : d) : (c > d ? c : d))) 461 #define MAX(a,b,c,d) (a > b ? (a > c ? (a > d ? a : d) : (c > d ? c : d)) : (b > c ? (b > d ? b : d) : (c > d ? c : d)))
458 462
459 print_disc(type) 463 void
460 char type; 464 print_disc(char type)
461 { 465 {
462 register bool *know = NULL; 466 register bool *know = NULL;
463 register char **guess = NULL; 467 register char **guess = NULL;
464 register int i, maxnum = 0, num_found; 468 register int i, maxnum = 0, num_found;
465 static THING obj; 469 static THING obj;
506 510
507 /* 511 /*
508 * set_order: 512 * set_order:
509 * Set up order for list 513 * Set up order for list
510 */ 514 */
511 set_order(order, numthings) 515 void
512 short *order; 516 set_order(short *order, int numthings)
513 int numthings;
514 { 517 {
515 register int i, r, t; 518 register int i, r, t;
516 519
517 for (i = 0; i< numthings; i++) 520 for (i = 0; i< numthings; i++)
518 order[i] = i; 521 order[i] = i;
589 /* 592 /*
590 * nothing: 593 * nothing:
591 * Set up prbuf so that message for "nothing found" is there 594 * Set up prbuf so that message for "nothing found" is there
592 */ 595 */
593 char * 596 char *
594 nothing(type) 597 nothing(char type)
595 register char type;
596 { 598 {
597 register char *sp, *tystr = NULL; 599 register char *sp, *tystr = NULL;
598 600
599 if (terse) 601 if (terse)
600 sprintf(prbuf, "Nothing"); 602 sprintf(prbuf, "Nothing");