comparison rogue4/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 1b73a8641b37
children
comparison
equal deleted inserted replaced
227:696277507a2e 228:b67b99f6c92b
46 /* 46 /*
47 * find_slot: 47 * find_slot:
48 * Find a particular slot in the table 48 * Find a particular slot in the table
49 */ 49 */
50 struct delayed_action * 50 struct delayed_action *
51 find_slot(int (*func)()) 51 find_slot(void (*func)())
52 { 52 {
53 register int i; 53 register int i;
54 register struct delayed_action *dev; 54 register struct delayed_action *dev;
55 55
56 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) 56 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++)
62 /* 62 /*
63 * start_daemon: 63 * start_daemon:
64 * Start a daemon, takes a function. 64 * Start a daemon, takes a function.
65 */ 65 */
66 void 66 void
67 start_daemon(int (*func)(), int arg, int type) 67 start_daemon(void (*func)(), int arg, int type)
68 { 68 {
69 register struct delayed_action *dev; 69 register struct delayed_action *dev;
70 70
71 dev = d_slot(); 71 dev = d_slot();
72 dev->d_type = type; 72 dev->d_type = type;
78 /* 78 /*
79 * kill_daemon: 79 * kill_daemon:
80 * Remove a daemon from the list 80 * Remove a daemon from the list
81 */ 81 */
82 void 82 void
83 kill_daemon(int (*func)()) 83 kill_daemon(void (*func)())
84 { 84 {
85 register struct delayed_action *dev; 85 register struct delayed_action *dev;
86 86
87 if ((dev = find_slot(func)) == NULL) 87 if ((dev = find_slot(func)) == NULL)
88 return; 88 return;
116 /* 116 /*
117 * fuse: 117 * fuse:
118 * Start a fuse to go off in a certain number of turns 118 * Start a fuse to go off in a certain number of turns
119 */ 119 */
120 void 120 void
121 fuse(int (*func)(), int arg, int time, int type) 121 fuse(void (*func)(), int arg, int time, int type)
122 { 122 {
123 register struct delayed_action *wire; 123 register struct delayed_action *wire;
124 124
125 wire = d_slot(); 125 wire = d_slot();
126 wire->d_type = type; 126 wire->d_type = type;
132 /* 132 /*
133 * lengthen: 133 * lengthen:
134 * Increase the time until a fuse goes off 134 * Increase the time until a fuse goes off
135 */ 135 */
136 void 136 void
137 lengthen(int (*func)(), int xtime) 137 lengthen(void (*func)(), int xtime)
138 { 138 {
139 register struct delayed_action *wire; 139 register struct delayed_action *wire;
140 140
141 if ((wire = find_slot(func)) == NULL) 141 if ((wire = find_slot(func)) == NULL)
142 return; 142 return;
146 /* 146 /*
147 * extinguish: 147 * extinguish:
148 * Put out a fuse 148 * Put out a fuse
149 */ 149 */
150 void 150 void
151 extinguish(int (*func)()) 151 extinguish(void (*func)())
152 { 152 {
153 register struct delayed_action *wire; 153 register struct delayed_action *wire;
154 154
155 if ((wire = find_slot(func)) == NULL) 155 if ((wire = find_slot(func)) == NULL)
156 return; 156 return;