Mercurial > hg > early-roguelike
comparison xrogue/options.c @ 220:f54901b9c39b
XRogue: convert to ANSI-style function declarations.
author | John "Elwin" Edwards |
---|---|
date | Wed, 02 Mar 2016 21:13:26 -0500 |
parents | aac28331e71d |
children | 50b89f165a34 |
comparison
equal
deleted
inserted
replaced
219:f9ef86cf22b2 | 220:f54901b9c39b |
---|---|
39 int (*o_getfunc)(); /* function to get value interactively */ | 39 int (*o_getfunc)(); /* function to get value interactively */ |
40 }; | 40 }; |
41 | 41 |
42 typedef struct optstruct OPTION; | 42 typedef struct optstruct OPTION; |
43 | 43 |
44 int put_bool(), | 44 int get_ro(WINDOW *win, int oy, int ox); |
45 get_bool(), | 45 void put_bool(bool *b, WINDOW *win); |
46 put_str(), | 46 int get_bool(bool *bp, WINDOW *win); |
47 get_str(), | 47 void put_str(char *str, WINDOW *win); |
48 put_abil(), | 48 int get_str(char *opt, WINDOW *win); |
49 get_abil(), | 49 void put_abil(int *ability, WINDOW *win); |
50 get_quest(), | 50 void get_abil(int *abil, WINDOW *win); |
51 put_quest(), | 51 void put_quest(int *quest, WINDOW *win); |
52 get_default(); | 52 void get_quest(int *quest, WINDOW *win); |
53 | 53 void get_default(bool *bp, WINDOW *win); |
54 int get_str_prot(char *opt, WINDOW *win); | 54 int get_str_prot(char *opt, WINDOW *win); |
55 int get_score(char *opt, WINDOW *win); | 55 int get_score(char *opt, WINDOW *win); |
56 bool allowchange(OPTION *op); | 56 bool allowchange(OPTION *op); |
57 | 57 |
58 OPTION optlist[] = { | 58 OPTION optlist[] = { |
86 | 86 |
87 /* | 87 /* |
88 * The default attribute field is read-only | 88 * The default attribute field is read-only |
89 */ | 89 */ |
90 | 90 |
91 get_default(bp, win) | 91 void |
92 bool *bp; | 92 get_default(bool *bp, WINDOW *win) |
93 WINDOW *win; | |
94 { | 93 { |
95 register int oy, ox; | 94 register int oy, ox; |
96 | 95 |
97 getyx(win, oy, ox); | 96 getyx(win, oy, ox); |
98 put_bool(bp, win); | 97 put_bool(bp, win); |
101 | 100 |
102 /* | 101 /* |
103 * The ability (class) field is read-only | 102 * The ability (class) field is read-only |
104 */ | 103 */ |
105 | 104 |
106 get_abil(abil, win) | 105 void |
107 int *abil; | 106 get_abil(int *abil, WINDOW *win) |
108 WINDOW *win; | |
109 { | 107 { |
110 register int oy, ox; | 108 register int oy, ox; |
111 | 109 |
112 getyx(win, oy, ox); | 110 getyx(win, oy, ox); |
113 put_abil(abil, win); | 111 put_abil(abil, win); |
116 | 114 |
117 /* | 115 /* |
118 * The quest field is read-only | 116 * The quest field is read-only |
119 */ | 117 */ |
120 | 118 |
121 get_quest(quest, win) | 119 void |
122 int *quest; | 120 get_quest(int *quest, WINDOW *win) |
123 WINDOW *win; | |
124 { | 121 { |
125 register int oy, ox; | 122 register int oy, ox; |
126 | 123 |
127 getyx(win, oy, ox); | 124 getyx(win, oy, ox); |
128 waddstr(win, rel_magic[*quest].mi_name); | 125 waddstr(win, rel_magic[*quest].mi_name); |
132 /* | 129 /* |
133 * get_ro: | 130 * get_ro: |
134 * "Get" a read-only value. | 131 * "Get" a read-only value. |
135 */ | 132 */ |
136 | 133 |
137 get_ro(win, oy, ox) | 134 int |
138 WINDOW *win; | 135 get_ro(WINDOW *win, int oy, int ox) |
139 register int oy, ox; | |
140 { | 136 { |
141 register int ny, nx; | 137 register int ny, nx; |
142 register bool op_bad; | 138 register bool op_bad; |
143 | 139 |
144 op_bad = TRUE; | 140 op_bad = TRUE; |
171 | 167 |
172 /* | 168 /* |
173 * allow changing a boolean option and print it out | 169 * allow changing a boolean option and print it out |
174 */ | 170 */ |
175 | 171 |
176 get_bool(bp, win) | 172 int |
177 bool *bp; | 173 get_bool(bool *bp, WINDOW *win) |
178 WINDOW *win; | |
179 { | 174 { |
180 register int oy, ox; | 175 register int oy, ox; |
181 register bool op_bad; | 176 register bool op_bad; |
182 | 177 |
183 op_bad = TRUE; | 178 op_bad = TRUE; |
221 | 216 |
222 /* | 217 /* |
223 * set a string option | 218 * set a string option |
224 */ | 219 */ |
225 | 220 |
226 get_str(opt, win) | 221 int |
227 register char *opt; | 222 get_str(char *opt, WINDOW *win) |
228 WINDOW *win; | |
229 { | 223 { |
230 register char *sp; | 224 register char *sp; |
231 register int c, oy, ox; | 225 register int c, oy, ox; |
232 char buf[LINELEN]; | 226 char buf[LINELEN]; |
233 | 227 |
296 | 290 |
297 /* | 291 /* |
298 * print and then set options from the terminal | 292 * print and then set options from the terminal |
299 */ | 293 */ |
300 | 294 |
301 option() | 295 void |
296 option(void) | |
302 { | 297 { |
303 register OPTION *op; | 298 register OPTION *op; |
304 register int retval; | 299 register int retval; |
305 | 300 |
306 wclear(hw); | 301 wclear(hw); |
354 * being stated as "name" (true) or "noname" (false), and strings | 349 * being stated as "name" (true) or "noname" (false), and strings |
355 * being "name=....", with the string being defined up to a comma | 350 * being "name=....", with the string being defined up to a comma |
356 * or the end of the entire option string. | 351 * or the end of the entire option string. |
357 */ | 352 */ |
358 | 353 |
359 parse_opts(str) | 354 void |
360 register char *str; | 355 parse_opts(char *str) |
361 { | 356 { |
362 register char *sp; | 357 register char *sp; |
363 register OPTION *op; | 358 register OPTION *op; |
364 register int len; | 359 register int len; |
365 | 360 |
464 | 459 |
465 /* | 460 /* |
466 * print the character type | 461 * print the character type |
467 */ | 462 */ |
468 | 463 |
469 put_abil(ability, win) | 464 void |
470 int *ability; | 465 put_abil(int *ability, WINDOW *win) |
471 WINDOW *win; | |
472 { | 466 { |
473 waddstr(win, char_class[*ability].name); | 467 waddstr(win, char_class[*ability].name); |
474 } | 468 } |
475 | 469 |
476 /* | 470 /* |
477 * print out the quest | 471 * print out the quest |
478 */ | 472 */ |
479 | 473 |
480 put_quest(quest, win) | 474 void |
481 int *quest; | 475 put_quest(int *quest, WINDOW *win) |
482 WINDOW *win; | |
483 { | 476 { |
484 waddstr(win, rel_magic[*quest].mi_name); | 477 waddstr(win, rel_magic[*quest].mi_name); |
485 } | 478 } |
486 | 479 |
487 /* | 480 /* |
488 * put out a boolean | 481 * put out a boolean |
489 */ | 482 */ |
490 | 483 |
491 put_bool(b, win) | 484 void |
492 bool *b; | 485 put_bool(bool *b, WINDOW *win) |
493 WINDOW *win; | |
494 { | 486 { |
495 waddstr(win, *b ? "True" : "False"); | 487 waddstr(win, *b ? "True" : "False"); |
496 } | 488 } |
497 | 489 |
498 /* | 490 /* |
499 * put out a string | 491 * put out a string |
500 */ | 492 */ |
501 | 493 |
502 put_str(str, win) | 494 void |
503 char *str; | 495 put_str(char *str, WINDOW *win) |
504 WINDOW *win; | |
505 { | 496 { |
506 waddstr(win, str); | 497 waddstr(win, str); |
507 } | 498 } |
508 | 499 |
509 /* Like get_str, but disallows changes when use_savedir is set. */ | 500 /* Like get_str, but disallows changes when use_savedir is set. */ |