Mercurial > hg > early-roguelike
comparison arogue5/daemon.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 | a5433ba4cabf |
children | b67b99f6c92b |
comparison
equal
deleted
inserted
replaced
217:94a0d9dd5ce1 | 218:56e748983fa8 |
---|---|
34 /* | 34 /* |
35 * d_slot: | 35 * d_slot: |
36 * Find an empty slot in the daemon list | 36 * Find an empty slot in the daemon list |
37 */ | 37 */ |
38 struct delayed_action * | 38 struct delayed_action * |
39 d_slot() | 39 d_slot(void) |
40 { | 40 { |
41 reg int i; | 41 reg int i; |
42 reg struct delayed_action *dev; | 42 reg struct delayed_action *dev; |
43 | 43 |
44 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) | 44 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) |
50 /* | 50 /* |
51 * f_slot: | 51 * f_slot: |
52 * Find an empty slot in the fuses list | 52 * Find an empty slot in the fuses list |
53 */ | 53 */ |
54 struct delayed_action * | 54 struct delayed_action * |
55 f_slot() | 55 f_slot(void) |
56 { | 56 { |
57 reg int i; | 57 reg int i; |
58 reg struct delayed_action *dev; | 58 reg struct delayed_action *dev; |
59 | 59 |
60 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++) | 60 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++) |
68 /* | 68 /* |
69 * find_slot: | 69 * find_slot: |
70 * Find a particular slot in the table | 70 * Find a particular slot in the table |
71 */ | 71 */ |
72 struct delayed_action * | 72 struct delayed_action * |
73 find_slot(func) | 73 find_slot(int (*func)()) |
74 reg int (*func)(); | |
75 { | 74 { |
76 reg int i; | 75 reg int i; |
77 reg struct delayed_action *dev; | 76 reg struct delayed_action *dev; |
78 | 77 |
79 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++) | 78 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++) |
85 | 84 |
86 /* | 85 /* |
87 * start_daemon: | 86 * start_daemon: |
88 * Start a daemon, takes a function. | 87 * Start a daemon, takes a function. |
89 */ | 88 */ |
89 void | |
90 start_daemon(int (*func)(), void *arg, int type) | 90 start_daemon(int (*func)(), void *arg, int type) |
91 { | 91 { |
92 reg struct delayed_action *dev; | 92 reg struct delayed_action *dev; |
93 | 93 |
94 dev = d_slot(); | 94 dev = d_slot(); |
104 | 104 |
105 /* | 105 /* |
106 * kill_daemon: | 106 * kill_daemon: |
107 * Remove a daemon from the list | 107 * Remove a daemon from the list |
108 */ | 108 */ |
109 kill_daemon(func) | 109 void |
110 reg int (*func)(); | 110 kill_daemon(int (*func)()) |
111 { | 111 { |
112 reg struct delayed_action *dev; | 112 reg struct delayed_action *dev; |
113 reg int i; | 113 reg int i; |
114 | 114 |
115 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) { | 115 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) { |
131 /* | 131 /* |
132 * do_daemons: | 132 * do_daemons: |
133 * Run all the daemons that are active with the current flag, | 133 * Run all the daemons that are active with the current flag, |
134 * passing the argument to the function. | 134 * passing the argument to the function. |
135 */ | 135 */ |
136 do_daemons(flag) | 136 void |
137 reg int flag; | 137 do_daemons(int flag) |
138 { | 138 { |
139 reg struct delayed_action *dev; | 139 reg struct delayed_action *dev; |
140 | 140 |
141 /* | 141 /* |
142 * Loop through the devil list | 142 * Loop through the devil list |
152 | 152 |
153 /* | 153 /* |
154 * fuse: | 154 * fuse: |
155 * Start a fuse to go off in a certain number of turns | 155 * Start a fuse to go off in a certain number of turns |
156 */ | 156 */ |
157 void | |
157 fuse(int (*func)(), void *arg, int time, int type) | 158 fuse(int (*func)(), void *arg, int time, int type) |
158 { | 159 { |
159 reg struct delayed_action *wire; | 160 reg struct delayed_action *wire; |
160 | 161 |
161 wire = f_slot(); | 162 wire = f_slot(); |
171 | 172 |
172 /* | 173 /* |
173 * lengthen: | 174 * lengthen: |
174 * Increase the time until a fuse goes off | 175 * Increase the time until a fuse goes off |
175 */ | 176 */ |
176 lengthen(func, xtime) | 177 void |
177 reg int (*func)(), xtime; | 178 lengthen(int (*func)(), int xtime) |
178 { | 179 { |
179 reg struct delayed_action *wire; | 180 reg struct delayed_action *wire; |
180 | 181 |
181 if ((wire = find_slot(func)) == NULL) | 182 if ((wire = find_slot(func)) == NULL) |
182 return; | 183 return; |
186 | 187 |
187 /* | 188 /* |
188 * extinguish: | 189 * extinguish: |
189 * Put out a fuse | 190 * Put out a fuse |
190 */ | 191 */ |
191 extinguish(func) | 192 void |
192 reg int (*func)(); | 193 extinguish(int (*func)()) |
193 { | 194 { |
194 reg struct delayed_action *wire; | 195 reg struct delayed_action *wire; |
195 | 196 |
196 if ((wire = find_slot(func)) == NULL) | 197 if ((wire = find_slot(func)) == NULL) |
197 return; | 198 return; |
205 | 206 |
206 /* | 207 /* |
207 * do_fuses: | 208 * do_fuses: |
208 * Decrement counters and start needed fuses | 209 * Decrement counters and start needed fuses |
209 */ | 210 */ |
210 do_fuses(flag) | 211 void |
211 reg int flag; | 212 do_fuses(int flag) |
212 { | 213 { |
213 reg struct delayed_action *wire; | 214 reg struct delayed_action *wire; |
214 | 215 |
215 /* | 216 /* |
216 * Step though the list | 217 * Step though the list |
232 | 233 |
233 /* | 234 /* |
234 * activity: | 235 * activity: |
235 * Show wizard number of demaons and memory blocks used | 236 * Show wizard number of demaons and memory blocks used |
236 */ | 237 */ |
237 activity() | 238 void |
239 activity(void) | |
238 { | 240 { |
239 sprintf(outstring,"Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d", | 241 sprintf(outstring,"Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d", |
240 demoncnt,fusecnt,total,md_memused()); | 242 demoncnt,fusecnt,total,md_memused()); |
241 msg(outstring); | 243 msg(outstring); |
242 } | 244 } |