comparison arogue5/options.c @ 218:56e748983fa8

Advanced Rogue 5: convert to ANSI function declarations. This still leaves over a thousand lines of warning messages, mostly related to the return types of daemons and fuses.
author John "Elwin" Edwards
date Sun, 07 Feb 2016 14:39:21 -0500
parents aac28331e71d
children 50b89f165a34
comparison
equal deleted inserted replaced
217:94a0d9dd5ce1 218:56e748983fa8
33 int (*o_getfunc)(); /* function to get value interactively */ 33 int (*o_getfunc)(); /* function to get value interactively */
34 }; 34 };
35 35
36 typedef struct optstruct OPTION; 36 typedef struct optstruct OPTION;
37 37
38 int put_bool(), 38 int get_ro(WINDOW *win, int oy, int ox);
39 get_bool(), 39 int get_restr(char *optstr, WINDOW *win);
40 put_str(), 40 int get_score(char *optstr, WINDOW *win);
41 get_str(), 41 void put_abil(int *ability, WINDOW *win);
42 get_restr(), 42 void get_abil(int *abil, WINDOW *win);
43 get_score(), 43 void put_quest(int *quest, WINDOW *win);
44 put_abil(), 44 void get_quest(int *quest, WINDOW *win);
45 get_abil(), 45 void put_bool(bool *b, WINDOW *win);
46 get_quest(), 46 int get_bool(bool *bp, WINDOW *win);
47 put_quest(); 47 void put_str(char *str, WINDOW *win);
48 48
49 OPTION optlist[] = { 49 OPTION optlist[] = {
50 {"terse", "Terse output: ", 50 {"terse", "Terse output: ",
51 (int *) &terse, put_bool, get_bool }, 51 (int *) &terse, put_bool, get_bool },
52 {"flush", "Flush typeahead during battle: ", 52 {"flush", "Flush typeahead during battle: ",
109 } 109 }
110 110
111 /* 111 /*
112 * The ability field is read-only 112 * The ability field is read-only
113 */ 113 */
114 get_abil(abil, win) 114 void
115 int *abil; 115 get_abil(int *abil, WINDOW *win)
116 WINDOW *win;
117 { 116 {
118 register int oy, ox; 117 register int oy, ox;
119 118
120 getyx(win, oy, ox); 119 getyx(win, oy, ox);
121 put_abil(abil, win); 120 put_abil(abil, win);
123 } 122 }
124 123
125 /* 124 /*
126 * The quest field is read-only 125 * The quest field is read-only
127 */ 126 */
128 get_quest(quest, win) 127 void
129 int *quest; 128 get_quest(int *quest, WINDOW *win)
130 WINDOW *win;
131 { 129 {
132 register int oy, ox; 130 register int oy, ox;
133 131
134 getyx(win, oy, ox); 132 getyx(win, oy, ox);
135 waddstr(win, rel_magic[*quest].mi_name); 133 waddstr(win, rel_magic[*quest].mi_name);
139 /* 137 /*
140 * get_ro: 138 * get_ro:
141 * "Get" a read-only value. 139 * "Get" a read-only value.
142 */ 140 */
143 141
144 get_ro(win, oy, ox) 142 int
145 WINDOW *win; 143 get_ro(WINDOW *win, int oy, int ox)
146 register int oy, ox;
147 { 144 {
148 register int ny, nx; 145 register int ny, nx;
149 register bool op_bad; 146 register bool op_bad;
150 147
151 op_bad = TRUE; 148 op_bad = TRUE;
178 175
179 /* 176 /*
180 * allow changing a boolean option and print it out 177 * allow changing a boolean option and print it out
181 */ 178 */
182 179
183 get_bool(bp, win) 180 int
184 bool *bp; 181 get_bool(bool *bp, WINDOW *win)
185 WINDOW *win;
186 { 182 {
187 register int oy, ox; 183 register int oy, ox;
188 register bool op_bad; 184 register bool op_bad;
189 185
190 op_bad = TRUE; 186 op_bad = TRUE;
228 224
229 225
230 /* 226 /*
231 * set a string option 227 * set a string option
232 */ 228 */
233 get_str(opt, win) 229 int
234 register char *opt; 230 get_str(char *opt, WINDOW *win)
235 WINDOW *win;
236 { 231 {
237 register char *sp; 232 register char *sp;
238 register int c, oy, ox; 233 register int c, oy, ox;
239 char buf[LINELEN]; 234 char buf[LINELEN];
240 235
304 299
305 300
306 /* 301 /*
307 * print and then set options from the terminal 302 * print and then set options from the terminal
308 */ 303 */
309 option() 304 void
305 option(void)
310 { 306 {
311 register OPTION *op; 307 register OPTION *op;
312 register int retval; 308 register int retval;
313 309
314 wclear(hw); 310 wclear(hw);
360 * being stated as "name" (true) or "noname" (false), and strings 356 * being stated as "name" (true) or "noname" (false), and strings
361 * being "name=....", with the string being defined up to a comma 357 * being "name=....", with the string being defined up to a comma
362 * or the end of the entire option string. 358 * or the end of the entire option string.
363 */ 359 */
364 360
365 parse_opts(str) 361 void
366 register char *str; 362 parse_opts(char *str)
367 { 363 {
368 register char *sp; 364 register char *sp;
369 register OPTION *op; 365 register OPTION *op;
370 register int len; 366 register int len;
371 367
457 453
458 454
459 /* 455 /*
460 * print the character type 456 * print the character type
461 */ 457 */
462 put_abil(ability, win) 458 void
463 int *ability; 459 put_abil(int *ability, WINDOW *win)
464 WINDOW *win;
465 { 460 {
466 char *abil; 461 char *abil;
467 462
468 switch (*ability) { 463 switch (*ability) {
469 case C_MAGICIAN:abil = "Magic User"; 464 case C_MAGICIAN:abil = "Magic User";
478 473
479 /* 474 /*
480 * print out the quest 475 * print out the quest
481 */ 476 */
482 477
483 put_quest(quest, win) 478 void
484 int *quest; 479 put_quest(int *quest, WINDOW *win)
485 WINDOW *win;
486 { 480 {
487 waddstr(win, rel_magic[*quest].mi_name); 481 waddstr(win, rel_magic[*quest].mi_name);
488 } 482 }
489 483
490 484
491 /* 485 /*
492 * put out a boolean 486 * put out a boolean
493 */ 487 */
494 put_bool(b, win) 488 void
495 bool *b; 489 put_bool(bool *b, WINDOW *win)
496 WINDOW *win;
497 { 490 {
498 waddstr(win, *b ? "True" : "False"); 491 waddstr(win, *b ? "True" : "False");
499 } 492 }
500 493
501 494
502 495
503 496
504 /* 497 /*
505 * put out a string 498 * put out a string
506 */ 499 */
507 put_str(str, win) 500 void
508 char *str; 501 put_str(char *str, WINDOW *win)
509 WINDOW *win;
510 { 502 {
511 waddstr(win, str); 503 waddstr(win, str);
512 } 504 }