comparison srogue/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 94a0d9dd5ce1
children
comparison
equal deleted inserted replaced
227:696277507a2e 228:b67b99f6c92b
32 /* 32 /*
33 * d_insert: 33 * d_insert:
34 * Insert a function in the daemon list. 34 * Insert a function in the daemon list.
35 */ 35 */
36 struct delayed_action * 36 struct delayed_action *
37 d_insert(int (*func)(), int arg, int type, int time) 37 d_insert(void (*func)(), int arg, int type, int time)
38 { 38 {
39 reg struct delayed_action *dev; 39 reg struct delayed_action *dev;
40 40
41 if (demoncnt < MAXDAEMONS) { 41 if (demoncnt < MAXDAEMONS) {
42 dev = &d_list[demoncnt]; 42 dev = &d_list[demoncnt];
70 /* 70 /*
71 * find_slot: 71 * find_slot:
72 * Find a particular slot in the table 72 * Find a particular slot in the table
73 */ 73 */
74 struct delayed_action * 74 struct delayed_action *
75 find_slot(int (*func)()) 75 find_slot(void (*func)())
76 { 76 {
77 reg struct delayed_action *dev; 77 reg struct delayed_action *dev;
78 78
79 for (dev = d_list; dev < &d_list[demoncnt]; dev++) 79 for (dev = d_list; dev < &d_list[demoncnt]; dev++)
80 if (dev->d_type != EMPTY && func == dev->d_func) 80 if (dev->d_type != EMPTY && func == dev->d_func)
85 /* 85 /*
86 * start_daemon: 86 * start_daemon:
87 * Start a daemon, takes a function. 87 * Start a daemon, takes a function.
88 */ 88 */
89 void 89 void
90 start_daemon(int (*func)(), int arg, int type) 90 start_daemon(void (*func)(), int arg, int type)
91 { 91 {
92 d_insert(func, arg, type, DAEMON); 92 d_insert(func, arg, type, DAEMON);
93 } 93 }
94 94
95 /* 95 /*
110 /* 110 /*
111 * fuse: 111 * fuse:
112 * Start a fuse to go off in a certain number of turns 112 * Start a fuse to go off in a certain number of turns
113 */ 113 */
114 void 114 void
115 fuse(int (*func)(), int arg, int time) 115 fuse(void (*func)(), int arg, int time)
116 { 116 {
117 d_insert(func, arg, AFTER, time); 117 d_insert(func, arg, AFTER, time);
118 } 118 }
119 119
120 /* 120 /*
121 * lengthen: 121 * lengthen:
122 * Increase the time until a fuse goes off 122 * Increase the time until a fuse goes off
123 */ 123 */
124 void 124 void
125 lengthen(int (*func)(), int xtime) 125 lengthen(void (*func)(), int xtime)
126 { 126 {
127 reg struct delayed_action *wire; 127 reg struct delayed_action *wire;
128 128
129 for (wire = d_list; wire < &d_list[demoncnt]; wire++) 129 for (wire = d_list; wire < &d_list[demoncnt]; wire++)
130 if (wire->d_type != EMPTY && func == wire->d_func) 130 if (wire->d_type != EMPTY && func == wire->d_func)
134 /* 134 /*
135 * extinguish: 135 * extinguish:
136 * Put out a fuse. Find all such fuses and kill them. 136 * Put out a fuse. Find all such fuses and kill them.
137 */ 137 */
138 void 138 void
139 extinguish(int (*func)()) 139 extinguish(void (*func)())
140 { 140 {
141 reg struct delayed_action *dev; 141 reg struct delayed_action *dev;
142 142
143 for (dev = d_list; dev < &d_list[demoncnt]; dev++) 143 for (dev = d_list; dev < &d_list[demoncnt]; dev++)
144 if (dev->d_type != EMPTY && func == dev->d_func) 144 if (dev->d_type != EMPTY && func == dev->d_func)