This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | muxevent_add (int time, int flags, int type, void(*func)(MUXEVENT *), void *data, void *data2) |
void | muxevent_run (void) |
int | muxevent_run_by_type (int type) |
int | muxevent_last_type (void) |
void | muxevent_initialize (void) |
void | muxevent_remove_data (void *data) |
void | muxevent_remove_type_data (int type, void *data) |
void | muxevent_remove_type_data2 (int type, void *data) |
void | muxevent_remove_type_data_data (int type, void *data, void *data2) |
int | muxevent_type_data (int type, void *data) |
void | muxevent_get_type_data (int type, void *data, int *data2) |
int | muxevent_count_type (int type) |
int | muxevent_count_type_data (int type, void *data) |
int | muxevent_count_type_data2 (int type, void *data) |
int | muxevent_count_type_data_data (int type, void *data, void *data2) |
int | muxevent_count_data (int type, void *data) |
int | muxevent_count_data_data (int type, void *data, void *data2) |
void | muxevent_gothru_type_data (int type, void *data, void(*func)(MUXEVENT *)) |
void | muxevent_gothru_type (int type, void(*func)(MUXEVENT *)) |
int | muxevent_last_type_data (int type, void *data) |
int | muxevent_first_type_data (int type, void *data) |
int | muxevent_count_type_data_firstev (int type, void *data) |
void muxevent_add | ( | int | time, | |
int | flags, | |||
int | type, | |||
void(*)(MUXEVENT *) | func, | |||
void * | data, | |||
void * | data2 | |||
) |
Definition at line 111 of file event.c.
References ADD_TO_BIDIR_LIST_HEAD, my_event_type::data, my_event_type::data2, my_event_type::ev, my_event_type::flags, my_event_type::function, last_muxevent_type, muxevent_first_in_type, muxevent_free_list, muxevent_list, muxevent_tick, muxevent_wakeup(), my_event_type::next, my_event_type::tick, and my_event_type::type.
Referenced by artillery_shoot(), and bomb_drop().
00112 { 00113 MUXEVENT *e = (MUXEVENT *)0xDEADBEEF; 00114 struct timeval tv = { 0, 0}; 00115 00116 int i, spot; 00117 00118 if (time < 1) 00119 time = 1; 00120 /* Nasty thing about the new system : we _do_ have to allocate 00121 muxevent_first_in_type dynamically. */ 00122 if (type > last_muxevent_type) { 00123 muxevent_first_in_type = 00124 realloc(muxevent_first_in_type, sizeof(MUXEVENT *) * (type + 1)); 00125 for (i = last_muxevent_type + 1; i <= type; i++) 00126 muxevent_first_in_type[i] = NULL; 00127 last_muxevent_type = type; 00128 } 00129 if (muxevent_free_list) { 00130 e = muxevent_free_list; 00131 muxevent_free_list = muxevent_free_list->next; 00132 } else { 00133 e = malloc(sizeof(MUXEVENT)); 00134 memset(e, 0, sizeof(MUXEVENT)); 00135 } 00136 00137 e->flags = flags; 00138 e->function = func; 00139 e->data = data; 00140 e->data2 = data2; 00141 e->type = type; 00142 e->tick = muxevent_tick + time; 00143 e->next = NULL; 00144 00145 00146 tv.tv_sec = time; 00147 tv.tv_usec = 0; 00148 00149 evtimer_set(&e->ev, muxevent_wakeup, e); 00150 evtimer_add(&e->ev, &tv); 00151 00152 ADD_TO_BIDIR_LIST_HEAD(muxevent_list, prev_in_main, next_in_main, e); 00153 ADD_TO_BIDIR_LIST_HEAD(muxevent_first_in_type[type], prev_in_type, 00154 next_in_type, e); 00155 }
int muxevent_count_data | ( | int | type, | |
void * | data | |||
) |
int muxevent_count_data_data | ( | int | type, | |
void * | data, | |||
void * | data2 | |||
) |
Definition at line 322 of file event.c.
References my_event_type::data, my_event_type::data2, and LoopEvent.
00322 { 00323 MUXEVENT *e; 00324 int count = 0; 00325 00326 LoopEvent(e) 00327 if (e->data == data && e->data2 == data2) 00328 count++; 00329 return count; 00330 }
int muxevent_count_type | ( | int | type | ) |
Definition at line 263 of file event.c.
References last_muxevent_type, and LoopType.
Referenced by debug_EventTypes().
00263 { 00264 MUXEVENT *e; 00265 int count = 0; 00266 00267 if (type > last_muxevent_type) 00268 return count; 00269 LoopType(type, e) 00270 count++; 00271 return count; 00272 }
int muxevent_count_type_data | ( | int | type, | |
void * | data | |||
) |
Definition at line 275 of file event.c.
References my_event_type::data, last_muxevent_type, and LoopType.
Referenced by auto_eventstats(), auto_pilot_on(), and DestroySection().
00275 { 00276 MUXEVENT *e; 00277 int count = 0; 00278 00279 if (type > last_muxevent_type) 00280 return count; 00281 LoopType(type, e) 00282 if (e->data == data) 00283 count++; 00284 return count; 00285 }
int muxevent_count_type_data2 | ( | int | type, | |
void * | data | |||
) |
Definition at line 287 of file event.c.
References my_event_type::data2, last_muxevent_type, and LoopType.
Referenced by DS_Bay_Is_EnterOK().
00287 { 00288 MUXEVENT *e; 00289 int count = 0; 00290 00291 if (type > last_muxevent_type) 00292 return count; 00293 LoopType(type, e) 00294 if (e->data2 == data) 00295 count++; 00296 return count; 00297 }
int muxevent_count_type_data_data | ( | int | type, | |
void * | data, | |||
void * | data2 | |||
) |
Definition at line 299 of file event.c.
References my_event_type::data, my_event_type::data2, last_muxevent_type, and LoopType.
00299 { 00300 MUXEVENT *e; 00301 int count = 0; 00302 00303 if (type > last_muxevent_type) 00304 return count; 00305 LoopType(type, e) 00306 if (e->data == data && e->data2 == data2) 00307 count++; 00308 return count; 00309 }
int muxevent_count_type_data_firstev | ( | int | type, | |
void * | data | |||
) |
Definition at line 378 of file event.c.
References my_event_type::data, my_event_type::data2, last_muxevent_type, and LoopType.
00378 { 00379 MUXEVENT *e; 00380 00381 if (type > last_muxevent_type) 00382 return -1; 00383 LoopType(type, e) 00384 if (e->data == data) 00385 { 00386 return (int) (e->data2); 00387 } 00388 return -1; 00389 }
int muxevent_first_type_data | ( | int | type, | |
void * | data | |||
) |
Definition at line 364 of file event.c.
References my_event_type::data, last_muxevent_type, LoopType, muxevent_tick, and my_event_type::tick.
00364 { 00365 MUXEVENT *e; 00366 int last = -1, t; 00367 00368 if (type > last_muxevent_type) 00369 return last; 00370 LoopType(type, e) 00371 if (e->data == data) 00372 if ((t = (e->tick - muxevent_tick)) < last || last < 0) 00373 if (t > 0) 00374 last = t; 00375 return last; 00376 }
void muxevent_get_type_data | ( | int | type, | |
void * | data, | |||
int * | data2 | |||
) |
Definition at line 254 of file event.c.
References my_event_type::data, my_event_type::data2, and LoopType.
00254 { 00255 MUXEVENT *e; 00256 00257 LoopType(type, e) 00258 if (e->data == data) 00259 *data2 = (int) e->data2; 00260 }
void muxevent_gothru_type | ( | int | type, | |
void(*)(MUXEVENT *) | func | |||
) |
Definition at line 342 of file event.c.
References last_muxevent_type, and LoopType.
Referenced by saverepairs().
00342 { 00343 MUXEVENT *e; 00344 00345 if (type > last_muxevent_type) 00346 return; 00347 LoopType(type, e) 00348 func(e); 00349 }
void muxevent_gothru_type_data | ( | int | type, | |
void * | data, | |||
void(*)(MUXEVENT *) | func | |||
) |
Definition at line 332 of file event.c.
References my_event_type::data, last_muxevent_type, and LoopType.
Referenced by CanScrapLoc(), figure_latest_tech_event(), mechSensorInfo(), show_sensor(), and tech_repairs().
00332 { 00333 MUXEVENT *e; 00334 00335 if (type > last_muxevent_type) 00336 return; 00337 LoopType(type, e) 00338 if (e->data == data) 00339 func(e); 00340 }
void muxevent_initialize | ( | void | ) |
int muxevent_last_type | ( | void | ) |
Definition at line 199 of file event.c.
References last_muxevent_type.
Referenced by debug_EventTypes().
00199 { 00200 return last_muxevent_type; 00201 }
int muxevent_last_type_data | ( | int | type, | |
void * | data | |||
) |
Definition at line 351 of file event.c.
References my_event_type::data, last_muxevent_type, LoopType, muxevent_tick, and my_event_type::tick.
Referenced by inferno_burn(), and ProlongUncon().
00351 { 00352 MUXEVENT *e; 00353 int last = 0, t; 00354 00355 if (type > last_muxevent_type) 00356 return last; 00357 LoopType(type, e) 00358 if (e->data == data) 00359 if ((t = (e->tick - muxevent_tick)) > last) 00360 last = t; 00361 return last; 00362 }
void muxevent_remove_data | ( | void * | data | ) |
Definition at line 211 of file event.c.
00211 { 00212 MUXEVENT *e; 00213 00214 for (e = muxevent_list; e; e = e->next_in_main) 00215 if (e->data == data) 00216 e->flags |= FLAG_ZOMBIE; 00217 }
void muxevent_remove_type_data | ( | int | type, | |
void * | data | |||
) |
Definition at line 219 of file event.c.
References my_event_type::data, FLAG_ZOMBIE, my_event_type::flags, last_muxevent_type, muxevent_first_in_type, and my_event_type::next_in_type.
Referenced by auto_radio_command_sensor(), auto_stop_pilot(), inferno_burn(), ProlongUncon(), and water_extinguish_inferno().
00219 { 00220 MUXEVENT *e; 00221 00222 if (type > last_muxevent_type) 00223 return; 00224 for (e = muxevent_first_in_type[type]; e; e = e->next_in_type) 00225 if (e->data == data) { 00226 00227 e->flags |= FLAG_ZOMBIE; 00228 } 00229 }
void muxevent_remove_type_data2 | ( | int | type, | |
void * | data | |||
) |
Definition at line 231 of file event.c.
References my_event_type::data2, FLAG_ZOMBIE, my_event_type::flags, last_muxevent_type, muxevent_first_in_type, and my_event_type::next_in_type.
00231 { 00232 MUXEVENT *e; 00233 00234 if (type > last_muxevent_type) 00235 return; 00236 for (e = muxevent_first_in_type[type]; e; e = e->next_in_type) 00237 if (e->data2 == data) 00238 e->flags |= FLAG_ZOMBIE; 00239 }
void muxevent_remove_type_data_data | ( | int | type, | |
void * | data, | |||
void * | data2 | |||
) |
Definition at line 241 of file event.c.
References my_event_type::data, my_event_type::data2, FLAG_ZOMBIE, my_event_type::flags, last_muxevent_type, muxevent_first_in_type, and my_event_type::next_in_type.
00241 { 00242 MUXEVENT *e; 00243 00244 if (type > last_muxevent_type) 00245 return; 00246 for (e = muxevent_first_in_type[type]; e; e = e->next_in_type) 00247 if (e->data == data && e->data2 == data2) 00248 e->flags |= FLAG_ZOMBIE; 00249 }
void muxevent_run | ( | void | ) |
Definition at line 177 of file event.c.
References muxevent_tick.
Referenced by main(), and UpdateSpecialObjects().
00177 { 00178 muxevent_tick += 1; 00179 }
int muxevent_run_by_type | ( | int | type | ) |
Definition at line 181 of file event.c.
References FLAG_ZOMBIE, last_muxevent_type, muxevent_first_in_type, my_event_type::next_in_type, postrun_event(), prerun_event(), and Zombie.
Referenced by ResetSpecialObjects().
00181 { 00182 MUXEVENT *e; 00183 int ran = 0; 00184 00185 if (type <= last_muxevent_type) { 00186 for (e = muxevent_first_in_type[type]; e; e = e->next_in_type) { 00187 if (!Zombie(e)) { 00188 prerun_event(e); 00189 e->function(e); 00190 postrun_event(e); 00191 e->flags |= FLAG_ZOMBIE; 00192 ran++; 00193 } 00194 } 00195 } 00196 return ran; 00197 }
int muxevent_type_data | ( | int | type, | |
void * | data | |||
) |