comparison arogue7/options.c @ 219:f9ef86cf22b2

Advanced Rogue 7: convert to ANSI-style function declarations. Almost 1500 lines of compiler warnings remain, and the GCC developers are already working on a new version with even more warnings turned on by default.
author John "Elwin" Edwards
date Fri, 19 Feb 2016 21:02:28 -0500
parents a307ff9cd95e
children 50b89f165a34
comparison
equal deleted inserted replaced
218:56e748983fa8 219:f9ef86cf22b2
38 int (*o_getfunc)(); /* function to get value interactively */ 38 int (*o_getfunc)(); /* function to get value interactively */
39 }; 39 };
40 40
41 typedef struct optstruct OPTION; 41 typedef struct optstruct OPTION;
42 42
43 int put_bool(), 43 void put_bool(bool *b, WINDOW *win);
44 get_bool(), 44 int get_bool(bool *bp, WINDOW *win);
45 put_str(), 45 void put_str(char *str, WINDOW *win);
46 get_str(), 46 int get_str(char *opt, WINDOW *win);
47 put_abil(), 47 void put_abil(int *ability, WINDOW *win);
48 get_abil(), 48 void get_abil(int *abil, WINDOW *win);
49 get_quest(), 49 void put_quest(int *quest, WINDOW *win);
50 put_quest(); 50 void get_quest(int *quest, WINDOW *win);
51 int get_ro(WINDOW *win, int oy, int ox);
51 52
52 int get_str_prot(char *opt, WINDOW *win); 53 int get_str_prot(char *opt, WINDOW *win);
53 int get_score(char *opt, WINDOW *win); 54 int get_score(char *opt, WINDOW *win);
54 bool allowchange(OPTION *op); 55 bool allowchange(OPTION *op);
55 56
81 }; 82 };
82 83
83 /* 84 /*
84 * The ability field is read-only 85 * The ability field is read-only
85 */ 86 */
86 get_abil(abil, win) 87 void
87 int *abil; 88 get_abil(int *abil, WINDOW *win)
88 WINDOW *win;
89 { 89 {
90 register int oy, ox; 90 register int oy, ox;
91 91
92 getyx(win, oy, ox); 92 getyx(win, oy, ox);
93 put_abil(abil, win); 93 put_abil(abil, win);
95 } 95 }
96 96
97 /* 97 /*
98 * The quest field is read-only 98 * The quest field is read-only
99 */ 99 */
100 get_quest(quest, win) 100 void
101 int *quest; 101 get_quest(int *quest, WINDOW *win)
102 WINDOW *win;
103 { 102 {
104 register int oy, ox; 103 register int oy, ox;
105 104
106 getyx(win, oy, ox); 105 getyx(win, oy, ox);
107 waddstr(win, rel_magic[*quest].mi_name); 106 waddstr(win, rel_magic[*quest].mi_name);
111 /* 110 /*
112 * get_ro: 111 * get_ro:
113 * "Get" a read-only value. 112 * "Get" a read-only value.
114 */ 113 */
115 114
116 get_ro(win, oy, ox) 115 int
117 WINDOW *win; 116 get_ro(WINDOW *win, int oy, int ox)
118 register int oy, ox;
119 { 117 {
120 register int ny, nx; 118 register int ny, nx;
121 register bool op_bad; 119 register bool op_bad;
122 120
123 op_bad = TRUE; 121 op_bad = TRUE;
150 148
151 /* 149 /*
152 * allow changing a boolean option and print it out 150 * allow changing a boolean option and print it out
153 */ 151 */
154 152
155 get_bool(bp, win) 153 int
156 bool *bp; 154 get_bool(bool *bp, WINDOW *win)
157 WINDOW *win;
158 { 155 {
159 register int oy, ox; 156 register int oy, ox;
160 register bool op_bad; 157 register bool op_bad;
161 158
162 op_bad = TRUE; 159 op_bad = TRUE;
200 197
201 198
202 /* 199 /*
203 * set a string option 200 * set a string option
204 */ 201 */
205 get_str(opt, win) 202 int
206 register char *opt; 203 get_str(char *opt, WINDOW *win)
207 WINDOW *win;
208 { 204 {
209 register char *sp; 205 register char *sp;
210 register int c, oy, ox; 206 register int c, oy, ox;
211 char buf[LINELEN]; 207 char buf[LINELEN];
212 208
276 272
277 273
278 /* 274 /*
279 * print and then set options from the terminal 275 * print and then set options from the terminal
280 */ 276 */
281 option() 277 void
278 option(void)
282 { 279 {
283 register OPTION *op; 280 register OPTION *op;
284 register int retval; 281 register int retval;
285 282
286 wclear(hw); 283 wclear(hw);
332 * being stated as "name" (true) or "noname" (false), and strings 329 * being stated as "name" (true) or "noname" (false), and strings
333 * being "name=....", with the string being defined up to a comma 330 * being "name=....", with the string being defined up to a comma
334 * or the end of the entire option string. 331 * or the end of the entire option string.
335 */ 332 */
336 333
337 parse_opts(str) 334 void
338 register char *str; 335 parse_opts(char *str)
339 { 336 {
340 register char *sp; 337 register char *sp;
341 register OPTION *op; 338 register OPTION *op;
342 register int len; 339 register int len;
343 340
426 423
427 424
428 /* 425 /*
429 * print the character type 426 * print the character type
430 */ 427 */
431 put_abil(ability, win) 428 void
432 int *ability; 429 put_abil(int *ability, WINDOW *win)
433 WINDOW *win;
434 { 430 {
435 waddstr(win, char_class[*ability].name); 431 waddstr(win, char_class[*ability].name);
436 } 432 }
437 433
438 434
439 /* 435 /*
440 * print out the quest 436 * print out the quest
441 */ 437 */
442 438
443 put_quest(quest, win) 439 void
444 int *quest; 440 put_quest(int *quest, WINDOW *win)
445 WINDOW *win;
446 { 441 {
447 waddstr(win, rel_magic[*quest].mi_name); 442 waddstr(win, rel_magic[*quest].mi_name);
448 } 443 }
449 444
450 445
451 /* 446 /*
452 * put out a boolean 447 * put out a boolean
453 */ 448 */
454 put_bool(b, win) 449 void
455 bool *b; 450 put_bool(bool *b, WINDOW *win)
456 WINDOW *win;
457 { 451 {
458 waddstr(win, *b ? "True" : "False"); 452 waddstr(win, *b ? "True" : "False");
459 } 453 }
460 454
461 455
462 456
463 457
464 /* 458 /*
465 * put out a string 459 * put out a string
466 */ 460 */
467 put_str(str, win) 461 void
468 char *str; 462 put_str(char *str, WINDOW *win)
469 WINDOW *win;
470 { 463 {
471 waddstr(win, str); 464 waddstr(win, str);
472 } 465 }
473 466
474 /* Like get_str, but disallows changes when use_savedir is set. */ 467 /* Like get_str, but disallows changes when use_savedir is set. */