Osiris_CancelTimer Purpose: Cancels a timer that's in use, given its handle
| 2480 | // Purpose: |
| 2481 | // Cancels a timer that's in use, given its handle |
| 2482 | void Osiris_CancelTimer(int handle) { |
| 2483 | int slot; |
| 2484 | |
| 2485 | slot = GET_SLOT(handle); |
| 2486 | |
| 2487 | if (slot < 0 || slot >= MAX_OSIRIS_TIMERS) |
| 2488 | return; |
| 2489 | |
| 2490 | if (OsirisTimers[slot].handle != handle) // not the same timer |
| 2491 | return; |
| 2492 | |
| 2493 | OsirisTimers[slot].flags &= ~OITF_USED; |
| 2494 | |
| 2495 | tOSIRISEventInfo ei; |
| 2496 | ei.evt_timercancel.detonated = 0; |
| 2497 | ei.evt_timercancel.handle = handle; |
| 2498 | |
| 2499 | if (OsirisTimers[slot].flags & OITF_TRIGGERTIMER) { |
| 2500 | Osiris_CallTriggerEvent(OsirisTimers[slot].trignum, EVT_TIMERCANCEL, &ei); |
| 2501 | } else if (OsirisTimers[slot].flags & OITF_LEVELTIMER) { |
| 2502 | Osiris_CallLevelEvent(EVT_TIMERCANCEL, &ei); |
| 2503 | } else { |
| 2504 | object *obj = ObjGet(OsirisTimers[slot].objhandle); |
| 2505 | if (obj) |
| 2506 | Osiris_CallEvent(obj, EVT_TIMERCANCEL, &ei); |
| 2507 | } |
| 2508 | } |
| 2509 | |
| 2510 | // Osiris_GetTimerHandle |
| 2511 | // Purpose: |
no test coverage detected