Mercurial > hg > early-roguelike
comparison rogue4/options.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 | e7dc81b41168 |
children | 50b89f165a34 |
comparison
equal
deleted
inserted
replaced
214:e5a15b09ce1d | 215:1b73a8641b37 |
---|---|
34 | 34 |
35 typedef struct optstruct OPTION; | 35 typedef struct optstruct OPTION; |
36 | 36 |
37 int allowchange(OPTION *opt); | 37 int allowchange(OPTION *opt); |
38 | 38 |
39 int put_bool(), get_bool(), put_str(), get_str(); | 39 void put_bool(bool *b); |
40 void put_str(char *str); | |
41 int get_bool(bool *bp, WINDOW *win); | |
42 int get_str(char *opt, WINDOW *win); | |
40 | 43 |
41 OPTION optlist[] = { | 44 OPTION optlist[] = { |
42 {"terse", "Terse output: ", | 45 {"terse", "Terse output: ", |
43 (int *) &terse, put_bool, get_bool }, | 46 (int *) &terse, put_bool, get_bool }, |
44 {"flush", "Flush typeahead during battle: ", | 47 {"flush", "Flush typeahead during battle: ", |
61 | 64 |
62 /* | 65 /* |
63 * option: | 66 * option: |
64 * Print and then set options from the terminal | 67 * Print and then set options from the terminal |
65 */ | 68 */ |
66 option() | 69 void |
70 option(void) | |
67 { | 71 { |
68 register OPTION *op; | 72 register OPTION *op; |
69 register int retval; | 73 register int retval; |
70 | 74 |
71 wclear(hw); | 75 wclear(hw); |
123 | 127 |
124 /* | 128 /* |
125 * put_bool | 129 * put_bool |
126 * Put out a boolean | 130 * Put out a boolean |
127 */ | 131 */ |
128 put_bool(b) | 132 void |
129 bool *b; | 133 put_bool(bool *b) |
130 { | 134 { |
131 waddstr(hw, *b ? "True" : "False"); | 135 waddstr(hw, *b ? "True" : "False"); |
132 } | 136 } |
133 | 137 |
134 /* | 138 /* |
135 * put_str: | 139 * put_str: |
136 * Put out a string | 140 * Put out a string |
137 */ | 141 */ |
138 put_str(str) | 142 void |
139 char *str; | 143 put_str(char *str) |
140 { | 144 { |
141 waddstr(hw, str); | 145 waddstr(hw, str); |
142 } | 146 } |
143 | 147 |
144 /* | 148 /* |
145 * get_bool: | 149 * get_bool: |
146 * Allow changing a boolean option and print it out | 150 * Allow changing a boolean option and print it out |
147 */ | 151 */ |
148 get_bool(bp, win) | 152 int |
149 bool *bp; | 153 get_bool(bool *bp, WINDOW *win) |
150 WINDOW *win; | |
151 { | 154 { |
152 register int oy, ox; | 155 register int oy, ox; |
153 register bool op_bad; | 156 register bool op_bad; |
154 | 157 |
155 op_bad = TRUE; | 158 op_bad = TRUE; |
194 * get_str: | 197 * get_str: |
195 * Set a string option | 198 * Set a string option |
196 */ | 199 */ |
197 #define MAXINP 50 /* max string to read from terminal or environment */ | 200 #define MAXINP 50 /* max string to read from terminal or environment */ |
198 | 201 |
199 get_str(opt, win) | 202 int |
200 register char *opt; | 203 get_str(char *opt, WINDOW *win) |
201 WINDOW *win; | |
202 { | 204 { |
203 register char *sp; | 205 register char *sp; |
204 register int c, oy, ox; | 206 register int c, oy, ox; |
205 char buf[MAXSTR]; | 207 char buf[MAXSTR]; |
206 | 208 |
272 #ifdef WIZARD | 274 #ifdef WIZARD |
273 /* | 275 /* |
274 * get_num: | 276 * get_num: |
275 * Get a numeric option | 277 * Get a numeric option |
276 */ | 278 */ |
277 get_num(opt, win) | 279 int |
278 short *opt; | 280 get_num(short *opt, WINDOW *win) |
279 WINDOW *win; | |
280 { | 281 { |
281 register int i; | 282 register int i; |
282 char buf[MAXSTR]; | 283 char buf[MAXSTR]; |
283 | 284 |
284 if ((i = get_str(buf, win)) == NORM) | 285 if ((i = get_str(buf, win)) == NORM) |
293 * The string is a series of comma seperated values, with booleans | 294 * The string is a series of comma seperated values, with booleans |
294 * being stated as "name" (true) or "noname" (false), and strings | 295 * being stated as "name" (true) or "noname" (false), and strings |
295 * being "name=....", with the string being defined up to a comma | 296 * being "name=....", with the string being defined up to a comma |
296 * or the end of the entire option string. | 297 * or the end of the entire option string. |
297 */ | 298 */ |
298 parse_opts(str) | 299 void |
299 register char *str; | 300 parse_opts(char *str) |
300 { | 301 { |
301 register char *sp; | 302 register char *sp; |
302 register OPTION *op; | 303 register OPTION *op; |
303 register int len; | 304 register int len; |
304 | 305 |
371 | 372 |
372 /* | 373 /* |
373 * strucpy: | 374 * strucpy: |
374 * Copy string using unctrol for things | 375 * Copy string using unctrol for things |
375 */ | 376 */ |
376 strucpy(s1, s2, len) | 377 void |
377 register char *s1, *s2; | 378 strucpy(char *s1, char *s2, int len) |
378 register int len; | |
379 { | 379 { |
380 if (len > MAXINP) | 380 if (len > MAXINP) |
381 len = MAXINP; | 381 len = MAXINP; |
382 while (len--) | 382 while (len--) |
383 { | 383 { |