UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_timer.cpp File Reference
#include "../cl_shared.h"
#include "ui_nodes.h"
#include "ui_timer.h"

Go to the source code of this file.

Macros

#define UI_TIMER_SLOT_NUMBER   10
 Number max of timer slot. More...
 

Functions

static void UI_RemoveTimerFromActiveList (uiTimer_t *timer)
 Remove a timer from the active linked list. More...
 
static void UI_InsertTimerInActiveList (uiTimer_t *first, uiTimer_t *newTimer)
 Insert a timer in a sorted linked list of timers. List are ordered from smaller to bigger nextTime value. More...
 
void UI_HandleTimers (void)
 Internal function to handle timers. More...
 
uiTimer_tUI_AllocTimer (uiNode_t *node, int firstDelay, timerCallback_t callback)
 Allocate a new time for a node. More...
 
void UI_TimerStart (uiTimer_t *timer)
 Restart a timer. More...
 
void UI_TimerStop (uiTimer_t *timer)
 Stop a timer. More...
 
void UI_TimerRelease (uiTimer_t *timer)
 Release the timer. It no more exists. More...
 
void UI_ResetTimers (void)
 

Variables

static uiTimer_t ui_timerSlots [UI_TIMER_SLOT_NUMBER]
 Timer slot. Only one. More...
 
static uiTimer_tui_firstTimer
 First timer from the timer list. This list is ordered from smaller to bigger nextTime value. More...
 

Macro Definition Documentation

#define UI_TIMER_SLOT_NUMBER   10

Number max of timer slot.

Definition at line 32 of file ui_timer.cpp.

Referenced by UI_AllocTimer(), and UI_RemoveTimerFromActiveList().

Function Documentation

uiTimer_t* UI_AllocTimer ( uiNode_t node,
int  firstDelay,
timerCallback_t  callback 
)

Allocate a new time for a node.

Parameters
[in]nodenode parent of the timer
[in]firstDelaymillisecond delay to wait the callback
[in]callbackcallback function to call every delay

Definition at line 123 of file ui_timer.cpp.

References uiTimer_s::callback, uiTimer_s::calledTime, Com_Error(), uiTimer_s::delay, ERR_FATAL, i, uiTimer_s::isRunning, uiTimer_s::next, uiTimer_s::owner, uiTimer_s::prev, timer, and UI_TIMER_SLOT_NUMBER.

Referenced by CL_BattlescapeRadarGenerateAll_f(), uiZoneNode::onMouseDown(), uiSpinnerNode::onMouseDown(), TEST_F(), UI_InitDraw(), UI_MouseDown(), and UI_VScrollbarNodeAction().

static void UI_InsertTimerInActiveList ( uiTimer_t first,
uiTimer_t newTimer 
)
static

Insert a timer in a sorted linked list of timers. List are ordered from smaller to bigger nextTime value.

Definition at line 66 of file ui_timer.cpp.

References uiTimer_s::next, uiTimer_s::nextTime, and uiTimer_s::prev.

Referenced by UI_HandleTimers(), and UI_TimerStart().

static void UI_RemoveTimerFromActiveList ( uiTimer_t timer)
inlinestatic

Remove a timer from the active linked list.

Note
The function doesn't set to null next and previous attributes of the timer

Definition at line 49 of file ui_timer.cpp.

References uiTimer_s::next, uiTimer_s::prev, and UI_TIMER_SLOT_NUMBER.

Referenced by UI_HandleTimers(), UI_TimerRelease(), and UI_TimerStop().

void UI_ResetTimers ( void  )

Definition at line 185 of file ui_timer.cpp.

References OBJZERO.

Referenced by UI_Shutdown().

Variable Documentation

uiTimer_t* ui_firstTimer
static

First timer from the timer list. This list is ordered from smaller to bigger nextTime value.

Definition at line 43 of file ui_timer.cpp.

Referenced by UI_HandleTimers().

uiTimer_t ui_timerSlots[UI_TIMER_SLOT_NUMBER]
static

Timer slot. Only one.

Definition at line 37 of file ui_timer.cpp.