comparison rogue4/io.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
comparison
equal deleted inserted replaced
214:e5a15b09ce1d 215:1b73a8641b37
14 #include <ctype.h> 14 #include <ctype.h>
15 #include <string.h> 15 #include <string.h>
16 #include "rogue.h" 16 #include "rogue.h"
17 #include <stdarg.h> 17 #include <stdarg.h>
18 18
19 void doadd(char *fmt, va_list ap);
20
19 /* 21 /*
20 * msg: 22 * msg:
21 * Display a message at the top of the screen. 23 * Display a message at the top of the screen.
22 */ 24 */
23 static char msgbuf[BUFSIZ]; 25 static char msgbuf[BUFSIZ];
24 static int newpos = 0; 26 static int newpos = 0;
25 27
28 void
26 msg(char *fmt, ...) 29 msg(char *fmt, ...)
27 { 30 {
28 va_list ap; 31 va_list ap;
29 /* 32 /*
30 * if the string is "", just clear the line 33 * if the string is "", just clear the line
48 /* 51 /*
49 * addmsg: 52 * addmsg:
50 * Add things to the current message 53 * Add things to the current message
51 */ 54 */
52 55
56 void
53 addmsg(char *fmt, ...) 57 addmsg(char *fmt, ...)
54 { 58 {
55 va_list ap; 59 va_list ap;
56 60
57 va_start(ap, fmt); 61 va_start(ap, fmt);
63 * endmsg: 67 * endmsg:
64 * Display a new msg (giving him a chance to see the previous one 68 * Display a new msg (giving him a chance to see the previous one
65 * if it is up there with the --More--) 69 * if it is up there with the --More--)
66 */ 70 */
67 71
68 endmsg() 72 void
73 endmsg(void)
69 { 74 {
70 if (save_msg) 75 if (save_msg)
71 { 76 {
72 strncpy(huh, msgbuf, 80); 77 strncpy(huh, msgbuf, 80);
73 huh[79] = 0; 78 huh[79] = 0;
97 /* 102 /*
98 * doadd: 103 * doadd:
99 * Perform an add onto the message buffer 104 * Perform an add onto the message buffer
100 */ 105 */
101 106
107 void
102 doadd(char *fmt, va_list ap) 108 doadd(char *fmt, va_list ap)
103 { 109 {
104 vsprintf(&msgbuf[newpos], fmt, ap); 110 vsprintf(&msgbuf[newpos], fmt, ap);
105 newpos = strlen(msgbuf); 111 newpos = strlen(msgbuf);
106 } 112 }
107 113
108 /* 114 /*
109 * step_ok: 115 * step_ok:
110 * Returns true if it is ok to step on ch 116 * Returns true if it is ok to step on ch
111 */ 117 */
112 step_ok(ch) 118 bool
119 step_ok(char ch)
113 { 120 {
114 switch (ch) 121 switch (ch)
115 { 122 {
116 case ' ': 123 case ' ':
117 case '|': 124 case '|':
125 /* 132 /*
126 * readchar: 133 * readchar:
127 * Flushes stdout so that screen is up to date and then returns 134 * Flushes stdout so that screen is up to date and then returns
128 * getchar(). 135 * getchar().
129 */ 136 */
130 readcharw(win) 137 int
131 WINDOW *win; 138 readcharw(WINDOW *win)
132 { 139 {
133 int ch; 140 int ch;
134 141
135 ch = md_readchar(win); 142 ch = md_readchar(win);
136 143
141 } 148 }
142 149
143 return(ch); 150 return(ch);
144 } 151 }
145 152
146 readchar() 153 int
154 readchar(void)
147 { 155 {
148 return( readcharw(stdscr) ); 156 return( readcharw(stdscr) );
149 } 157 }
150 158
151 char * 159 char *
152 unctrol(ch) 160 unctrol(char ch)
153 char ch;
154 { 161 {
155 return( (char *) unctrl(ch) ); 162 return( (char *) unctrl(ch) );
156 } 163 }
157 164
158 /* 165 /*
159 * status: 166 * status:
160 * Display the important stats line. Keep the cursor where it was. 167 * Display the important stats line. Keep the cursor where it was.
161 */ 168 */
162 status() 169 void
170 status(void)
163 { 171 {
164 register int oy, ox, temp; 172 register int oy, ox, temp;
165 static int hpwidth = 0, s_hungry; 173 static int hpwidth = 0, s_hungry;
166 static int s_lvl, s_pur = -1, s_hp, s_ac = 0; 174 static int s_lvl, s_pur = -1, s_hp, s_ac = 0;
167 static str_t s_str; 175 static str_t s_str;
213 * Sit around until the guy types the right key 221 * Sit around until the guy types the right key
214 */ 222 */
215 223
216 224
217 225
218 wait_for(ch) 226 void
219 register char ch; 227 wait_for(char ch)
220 { 228 {
221 w_wait_for(stdscr, ch); 229 w_wait_for(stdscr, ch);
222 } 230 }
223 231
224 w_wait_for(win,ch) 232 void
225 WINDOW *win; 233 w_wait_for(WINDOW *win, char ch)
226 register char ch;
227 { 234 {
228 register char c; 235 register char c;
229 236
230 if (ch == '\n') 237 if (ch == '\n')
231 while ((c = readcharw(win)) != '\n' && c != '\r') 238 while ((c = readcharw(win)) != '\n' && c != '\r')
237 244
238 /* 245 /*
239 * show_win: 246 * show_win:
240 * Function used to display a window and wait before returning 247 * Function used to display a window and wait before returning
241 */ 248 */
242 show_win(scr, message) 249 void
243 register WINDOW *scr; 250 show_win(WINDOW *scr, char *message)
244 char *message;
245 { 251 {
246 mvwaddstr(scr, 0, 0, message); 252 mvwaddstr(scr, 0, 0, message);
247 touchwin(scr); 253 touchwin(scr);
248 wmove(scr, hero.y, hero.x); 254 wmove(scr, hero.y, hero.x);
249 wrefresh(scr); 255 wrefresh(scr);