comparison arogue7/daemon.c @ 228:b67b99f6c92b

Daemons and fuses now return void. Functions for starting and stopping daemons and fuses now expect the type 'void (*func)()'. Only a few functions in XRogue needed to be modified to fit. Determining the type of the argument is left for a later date. Building with GCC5 should now produce less than 200 lines of warnings per game.
author John "Elwin" Edwards
date Sat, 05 Mar 2016 20:49:37 -0500
parents f9ef86cf22b2
children e1cd27c5464f
comparison
equal deleted inserted replaced
227:696277507a2e 228:b67b99f6c92b
76 /* 76 /*
77 * find_slot: 77 * find_slot:
78 * Find a particular slot in the table 78 * Find a particular slot in the table
79 */ 79 */
80 struct delayed_action * 80 struct delayed_action *
81 find_slot(int (*func)()) 81 find_slot(void (*func)())
82 { 82 {
83 reg int i; 83 reg int i;
84 reg struct delayed_action *dev; 84 reg struct delayed_action *dev;
85 85
86 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++) 86 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++)
93 /* 93 /*
94 * start_daemon: 94 * start_daemon:
95 * Start a daemon, takes a function. 95 * Start a daemon, takes a function.
96 */ 96 */
97 void 97 void
98 start_daemon(int (*func)(), int arg, int type) 98 start_daemon(void (*func)(), int arg, int type)
99 { 99 {
100 reg struct delayed_action *dev; 100 reg struct delayed_action *dev;
101 101
102 dev = d_slot(); 102 dev = d_slot();
103 if (dev != NULL) { 103 if (dev != NULL) {
113 /* 113 /*
114 * kill_daemon: 114 * kill_daemon:
115 * Remove a daemon from the list 115 * Remove a daemon from the list
116 */ 116 */
117 void 117 void
118 kill_daemon(int (*func)()) 118 kill_daemon(void (*func)())
119 { 119 {
120 reg struct delayed_action *dev; 120 reg struct delayed_action *dev;
121 reg int i; 121 reg int i;
122 122
123 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) { 123 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) {
161 /* 161 /*
162 * fuse: 162 * fuse:
163 * Start a fuse to go off in a certain number of turns 163 * Start a fuse to go off in a certain number of turns
164 */ 164 */
165 void 165 void
166 fuse(int (*func)(), int arg, int time, int type) 166 fuse(void (*func)(), int arg, int time, int type)
167 { 167 {
168 reg struct delayed_action *wire; 168 reg struct delayed_action *wire;
169 169
170 wire = f_slot(); 170 wire = f_slot();
171 if (wire != NULL) { 171 if (wire != NULL) {
181 /* 181 /*
182 * lengthen: 182 * lengthen:
183 * Increase the time until a fuse goes off 183 * Increase the time until a fuse goes off
184 */ 184 */
185 void 185 void
186 lengthen(int (*func)(), int xtime) 186 lengthen(void (*func)(), int xtime)
187 { 187 {
188 reg struct delayed_action *wire; 188 reg struct delayed_action *wire;
189 189
190 if ((wire = find_slot(func)) == NULL) 190 if ((wire = find_slot(func)) == NULL)
191 return; 191 return;
196 /* 196 /*
197 * extinguish: 197 * extinguish:
198 * Put out a fuse 198 * Put out a fuse
199 */ 199 */
200 void 200 void
201 extinguish(int (*func)()) 201 extinguish(void (*func)())
202 { 202 {
203 reg struct delayed_action *wire; 203 reg struct delayed_action *wire;
204 204
205 if ((wire = find_slot(func)) == NULL) 205 if ((wire = find_slot(func)) == NULL)
206 return; 206 return;